【网络成长记】xxx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
[root@ningan ~]# ip netns list
[root@ningan ~]#
[root@ningan ~]# ip netns help
Usage: ip netns list
ip netns add NAME
ip netns set NAME NETNSID
ip [-all] netns delete [NAME]
ip netns identify [PID]
ip netns pids NAME
ip [-all] netns exec [NAME] cmd ...
ip netns monitor
ip netns list-id
[root@ningan ~]#
[root@ningan ~]#
[root@ningan ~]#
[root@ningan ~]# ip netns add netns1
[root@ningan ~]#
[root@ningan ~]# ip netns exec netns1 ip a
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
[root@ningan ~]#
[root@ningan ~]#
[root@ningan ~]#
[root@ningan ~]# ip netns exec netns1 ip link list
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
[root@ningan ~]#
[root@ningan ~]#
[root@ningan ~]# ip netns list
netns1






[root@ningan ~]# ip netns exec netns1 ping 127.0.0.1
connect: Network is unreachable
[root@ningan ~]# ip netns exec netns1 ip link set dev lo up
[root@ningan ~]# ip netns exec netns1 ip link list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
[root@ningan ~]# ip netns exec netns1 ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.013 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.022 ms
^C
--- 127.0.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1024ms
rtt min/avg/max/mdev = 0.013/0.017/0.022/0.006 ms
1
2
3
4
5
[root@ningan ~]# ip link add veth0 type veth peer name veth1
[root@ningan ~]# ip link set veth1 netns netns1
[root@ningan ~]#
[root@ningan ~]# ip netns exec netns1 ifconfig veth1 10.1.1.1/24 up
[root@ningan ~]# ifconfig veth0 10.1.1.2/24 up

【网络成长记】xxx
http://example.com/2024/10/31/net/【网络成长记】xxx/
作者
ningan123
发布于
2024年10月31日
许可协议