Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!

Ogłoszenie

Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.

#1  2015-12-18 02:38:02

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/random
Zarejestrowany: 2008-01-07

[+]Namespaces ip netns - brak komunikacji veth0 <=> veth1

Cześć


Chciałem się pobawić namespaces, przetrawiłem kilka tutków na ten temat,
i jest mała zagwozdka:

Kontenerek z własnym podsystem sieciowym tworzy się bez problemu:

Kod:

ip netns add nstest
ip link add veth0 type veth peer name veth1
ip link set veth1 netns nstest
ip addr add 10.20.0.1/24 dev veth0
ip link set veth0 up
ip netns exec nstest ip addr add 10.20.0.2/24 dev veth1
ip netns exec nstest ip link set dev veth1 up
ip netns exec nstest ip link set dev lo up
ip netns exec nstest ip route add default via 10.20.0.1

Co się zrobiło:

Kod:

ifconfig veth0
veth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.20.0.1  netmask 255.255.255.0  broadcast 10.20.0.255
        inet6 fe80::14fe:60ff:fe3d:13ad  prefixlen 64  scopeid 0x20<link>
        ether 16:fe:60:3d:13:ad  txqueuelen 1000  (Ethernet)
        RX packets 313  bytes 13458 (13.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4  bytes 360 (360.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Kod:

 ip netns exec nstest ifconfig 
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 488  bytes 48453 (47.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 488  bytes 48453 (47.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.20.0.2  netmask 255.255.255.0  broadcast 10.20.0.255
        inet6 fe80::bc00:a0ff:fe17:cfa4  prefixlen 64  scopeid 0x20<link>
        ether be:00:a0:17:cf:a4  txqueuelen 1000  (Ethernet)
        RX packets 4  bytes 360 (360.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 313  bytes 13458 (13.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Kod:

 ip netns exec nstest route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.20.0.1       0.0.0.0         UG    0      0        0 veth1
10.20.0.0       0.0.0.0         255.255.255.0   U     0      0        0 veth1

Odpalam mały test:
na jednym terminalu:

Kod:

ip netns exec nstest tcpdump -i veth1 -vvv

na drugim:

Kod:

ip netns exec nstest ping -c 3 10.20.0.1
PING 10.20.0.1 (10.20.0.1) 56(84) bytes of data.
From 10.20.0.2: icmp_seq=1 Destination Host Unreachable
From 10.20.0.2: icmp_seq=2 Destination Host Unreachable
From 10.20.0.2: icmp_seq=3 Destination Host Unreachable

I cała komunikacja kończy się na komunikatach:

Kod:

ARP,  Request who-has 10.20.0.1 tell 10.20.0.2, length 28

Jakieś pomysły?

EDIT:
Zapomniałem na śmierć o tym, że wieki temu poblokowałem ARPY przez arptables domyślnie dla wszystkich interfejsów....

Kod:

arptables -I INPUT -i  veth+ -j ACCEPT

Załatwiło sprawę.

Ostatnio edytowany przez Jacekalex (2015-12-18 02:55:21)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

Stopka forum

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson
Nas ludzie lubią po prostu, a nie klikając w przyciski ;-)