1
my isp gives me up to two ipv4 addresses. i have a raspberry pi with archlinux connected to the modem. first interface is eth0 and the ip address is obtained via dhcp.
i created a virtual device with
ip link add link eth0 address 00:11:11:11:11:11 eth0.1 type macvlan
and gave that device an ip with
dhcpcd eth0.1
my routing table now looks like (i changed the public adresses to 10.0.x.x):
[root@core ~]# ip route
default via 10.0.26.1 dev eth0 metric 204
default via 10.0.24.1 dev eth0.1 metric 206
10.0.24.0/23 dev eth0.1 proto kernel scope link src 10.0.24.195 metric 206
10.0.26.0/24 dev eth0 proto kernel scope link src 10.0.26.219 metric 204
192.168.178.0/24 dev eth1 proto kernel scope link src 192.168.178.1
with firewall and everything disabled i tried
ping -I eth0.1 www.google.de
but that did not work.
i changed the metric from the 2nd route from 206 to 100 and then it worked. but now pings from eth0 are broken.
as far as my network understanding goes, i expect that pinging from both devices should be working.
my next action was to dump traffic (i changed my public ip to 10.0.x.x)
[root@core ~]# ping -I eth0.1 www.google.de (no output was shown here)
[root@core ~]# tcpdump -i eth0.1 icmp
11:32:18.344731 IP 10.0.24.195 > ham02s11-in-f23.1e100.net: ICMP echo request, id 1841, seq 1, length 64
11:32:18.368186 IP ham02s11-in-f23.1e100.net > 10.0.24.195: ICMP echo reply, id 1841, seq 1, length 64
i also looked at the dump in wireshark, for me it looked perfectly cool. arp and ip addresses of eth0.1 were used. (00:11:11:11:11:11 and 10.0.24.195)
here is the output of my interface informations
[root@core ~]# ip addr
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether b8:27:eb:fe:e6:87 brd ff:ff:ff:ff:ff:ff
inet 10.0.26.219/24 brd 10.0.26.255 scope global eth0
valid_lft forever preferred_lft forever
6: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
link/ether 00:11:11:11:11:11 brd ff:ff:ff:ff:ff:ff
inet 10.0.24.195/23 brd 10.0.25.255 scope global eth0.1
valid_lft forever preferred_lft forever
i noticed some things that seem weird to me, but iam not sure.
- state of eth0.1 UNKNOWN
- netmask of eth0.1 is /23 , not /24
- brd of eth0.1 is 10.0.25.255, compared to eth0 i would expect 10.0.24.255
i hope anyone can give me some advice.