![]() # 将 veth0 接口 up 起来 $ ip -n ns1 link set veth0 up # 分配 veth0 接口到 ns1 网络命名空间 $ ip link set veth0 netns ns1 □ The -n option is short for ip netns execįirst we use the ip link add command to create a new pair of veth interfaces: veth0 and veth1. The -n option can be used to switch the destination namespace, for example, to assign the 10.0.1.0/24 IP address range to interface veth0 in the ns1 network namespace, use the ip -n ns1 addr add 10.0.1.0/24 dev veth0 command. To remove a route from the routing table, use the ip route del dev command.To assign a new IP address range to an interface, use the ip addr add dev command.To add a new network interface, use the ip link add type.# ARGUMENTS are arguments specific to the kind of OBJECT # and COMMAND ![]() Ip OBJECT COMMAND # where # OPTIONS are general global options # OBJECT := # COMMAND is the action to perform on the object, such as, # show, add, del etc. The usage of this command is shown below. The ip command is used to display or manipulate routes, network devices, policy routes, and tunnels for Linux hosts, and is a newer and powerful network configuration tool for Linux. For example, rules added to a network namespace by iptables will only affect traffic entering and leaving that namespace. Network namespaces can virtualize network stacks, and each network namespace has its own resources, such as network interfaces, IP addresses, routing tables, tunnels, firewalls, etc. We know that the container runtime uses the namespace (namespace) kernel function to partition system resources for some form of process isolation, so that changes to resources in one namespace do not affect resources in other namespaces, including process IDs, host names, user IDs, file names, network interfaces, etc. In this article I will demonstrate how to use the command to connect processes in different subnets of the network namespace through a pair of veth interfaces.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |