1
0
My Lap: Ubuntu 15.10. And I have a wired NIC enp0s3
. I want to create a veth pair veth0
and veth1
and bridge them with enp0s3
, and set veth1
to a new netns ns1
, so that processes in ns1
can access the Internet through link layer.
But it's strange that veth1
can't ping enp0s3
. The following is my steps.
root@qs-vs:~# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:62:3c:59 brd ff:ff:ff:ff:ff:ff
root@qs-vs:~# ip netns add ns1
root@qs-vs:~# ip link add type veth
root@qs-vs:~# ip link set veth1 netns ns1
root@qs-vs:~# ip link add bridge type bridge
root@qs-vs:~# ip link set enp0s3 master bridge
root@qs-vs:~# ip link set veth0 master bridge
root@qs-vs:~# ip link set up veth0
root@qs-vs:~# ip link set up enp0s3
root@qs-vs:~# ip link set up bridge
root@qs-vs:~# ip netns exec ns1 ip link set up veth1
root@qs-vs:~# ip addr add 192.168.222.1/24 dev enp0s3
root@qs-vs:~# ip netns exec ns1 ip addr add 192.168.222.101/24 dev veth1
root@qs-vs:~# ping 192.168.222.101
PING 192.168.222.101 (192.168.222.101) 56(84) bytes of data.
From 192.168.222.1 icmp_seq=1 Destination Host Unreachable
From 192.168.222.1 icmp_seq=2 Destination Host Unreachable
From 192.168.222.1 icmp_seq=3 Destination Host Unreachable
From 192.168.222.1 icmp_seq=4 Destination Host Unreachable
From 192.168.222.1 icmp_seq=5 Destination Host Unreachable
From 192.168.222.1 icmp_seq=6 Destination Host Unreachable
^C
--- 192.168.222.101 ping statistics ---
7 packets transmitted, 0 received, +6 errors, 100% packet loss, time 6028ms
pipe 3
I have also tried turn on promisc with enp0s3, but it doesn't help.
once an interface becomes a bridge port, IP on it is ignored. so
ip link set enp0s3 master bridge
andip addr add 192.168.222.1/24 dev enp0s3
are incompatible – A.B – 2019-03-21T21:47:31.107