0

I up a vlan device eth0.100 as 192.168.1.100. The eth0 have address 10.137.16.108

It looks work good when I ping with address.

$ ping 10.137.16.108 -I 192.168.1.1

PING 10.137.16.108 (10.137.16.108) from 192.168.1.100 : 56(84) bytes of data.
64 bytes from 10.137.16.108: icmp_seq=1 ttl=64 time=0.153 ms
64 bytes from 10.137.16.108: icmp_seq=2 ttl=64 time=0.058 ms
64 bytes from 10.137.16.108: icmp_seq=3 ttl=64 time=0.060 ms
^C
--- 10.137.16.108 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms rtt min/avg/max/mdev = 0.058/0.090/0.153/0.045 ms

but if I use device name eth0.100 to do same ping got Destination Host Unreachable.

$ ping 10.137.16.108 -I eth0.100

PING 10.137.16.108 (10.137.16.108) from 192.168.1.100 eth0.100: 56(84) bytes of data.
From 192.168.1.100 icmp_seq=1 Destination Host Unreachable
From 192.168.1.100 icmp_seq=2 Destination Host Unreachable
From 192.168.1.100 icmp_seq=3 Destination Host Unreachable
^C
--- 10.137.16.108 ping statistics ---
5 packets transmitted, 0 received, +3 errors, 100% packet loss, time 4024ms

I guess that is a issue about arp table

$ arp

 Address            HWtype  HWaddress   Flags Mask            Iface
 10.137.16.108        (incomplete)                          eth0.100

Because I need the vlan device name to use SOL_SOCKET & SO_BINDTODEVICE to send raw socket Could you help me.

Thanks

  • Could you add the output of ip addr show and ip route show? – GnP Aug 31 '16 at 3:55
0

Update:

My target is want manipulate traffic control a shared device bandwidth to 10 or more small vm or program. I used vconfig command make virtual interfaces and use tc command. The dev maked with vconfig looks good when I use address for traffic between host and virtual dev. But it looks have problem when I use the virtual dev label for traffic by ip protocol.

I find a way to clear my problem. As this post: [How can I create a virtual ethernet interface on a machine without a physical adapter?

The solution is use the iproute2 toolkit. It make a peer virtual interfaces.

ip link add veth0 type veth peer name veth1

Add address for both virtual device.

sudo ip addr add 10.1.1.1/24 dev veth1 && ip set dev veth1 up
sudo ip addr add 10.1.1.2/24 dev veth1 && ip set dev veth2 up

Then I can use the dev name as veth2 to ping 10.1.1.1 looks working.

ping 10.1.1.1 -I veth2

 PING 10.1.1.1 (10.1.1.1) from 10.1.1.1 veth2: 56(84) bytes of data.
 64 bytes from 10.1.1.1: icmp_seq=1 ttl=64 time=0.021 ms
 64 bytes from 10.1.1.1: icmp_seq=2 ttl=64 time=0.041 ms
 ^C
 --- 10.1.1.1 ping statistics ---
 5 packets transmitted, 5 received, 0% packet loss, time 3999ms

I find the veth kind virtual device have dummy Mac address. May be it is working for ARP and RARP.

veth1     Link encap:Ethernet  HWaddr 1a:8d:89:82:da:68  
      inet addr:10.1.1.1  Bcast:0.0.0.0  Mask:255.255.255.0
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

veth2     Link encap:Ethernet  HWaddr 2e:11:c9:ad:9c:e7  
      inet addr:10.1.1.1  Bcast:0.0.0.0  Mask:255.255.255.0
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Thank you for your help.

Peter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.