You are not logged in.
Hi,
I am having a problem with IP traffic routing when using two network interfaces.
I have two network interfaces configured (this is on a set of VirtualBox VMs):
ost@lithium ~> ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:a6:95:56 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.5/24 brd 10.0.2.255 scope global enp0s3
valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:8c:1c:3e brd ff:ff:ff:ff:ff:ff
inet 10.1.1.11/24 brd 10.1.1.255 scope global enp0s8
valid_lft forever preferred_lft forever
enp0s3 is connected to a VirtualBox NAT network where 10.0.2.* are provided via DHCP
enp0s8 is connected to a VirtualBox host-only network without DHCP.
I am using netctl for network configurations. I have a profile for each interface:
enp0s3
ost@lithium ~> cat /etc/netctl/network-profile_vb-nat
Description='Network Profile: VirtualBox NAT using dhcp.'
Interface=enp0s3
Connection=ethernet
IP=dhcp
enp0s8
ost@lithium ~> cat /etc/netctl/network-profile_vb-host-only_static
Description='Network Profile: VirtualBox Host-Only using static IP 10.1.1.11.'
Interface=enp0s8
Connection=ethernet
IP=static
Address=('10.1.1.11/24')
Gateway='10.1.1.1'
DNS=('10.1.1.1')
No profiles are loaded on boot. I am starting everything manually.
If I use only the enp0s8 profile, i.e.
ost@lithium ~> sudo netctl start network-profile_vb-host-only_static
I am able to ping/ssh any machines in the 10.1.1.* network (i.e. the VirtualBox host-only network).
If I use only the enp0s3 profile, i.e.
ost@lithium ~> sudo netctl start network-profile_vb-nat
I am able to connect to my host machine and to the network thereafter (incl. the internet).
Now my problem occurs when I try to use both profiles at the same time, i.e.:
ost@lithium ~> sudo netctl start network-profile_vb-host-only_static
ost@lithium ~> sudo netctl start network-profile_vb-nat
In that situation I am still able to connect to machines with 10.1.1.* addresses (i.e. in the host-only network), but I am no longer able to access the internet through the host's NAT.
Looking at the routes I get the following:
ost@lithium ~> ip route
default via 10.1.1.1 dev enp0s8
default via 10.0.2.1 dev enp0s3 metric 202
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.5 metric 202
10.1.1.0/24 dev enp0s8 proto kernel scope link src 10.1.1.11
ost@lithium ~> ping google.com
^Cfish: Job 1, “ping google.com” terminated by signal SIGINT (Quit request from job control (^C)) #TIMEOUT
I can remove a route using the following command to restore access to the internet:
ost@lithium ~> sudo ip route delete default via 10.1.1.1 dev enp0s8
ost@lithium ~> ip route
default via 10.0.2.1 dev enp0s3 metric 202
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.5 metric 202
10.1.1.0/24 dev enp0s8 proto kernel scope link src 10.1.1.11
ost@lithium ~> ping google.com
PING google.com (173.194.44.65) 56(84) bytes of data.
64 bytes from ham02s14-in-f1.1e100.net (173.194.44.65): icmp_seq=1 ttl=55 time=8.75 ms
^C
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 8.756/8.756/8.756/0.000 ms
Now I want to avoid deleting the route manually using ip route delete and am trying to understand how I need to change my netctl profiles to make this work automatically (i.e. simply by starting/stopping the profiles).
I would be grateful for any guidance!
Thanks
Last edited by o1iver (2014-07-21 13:10:48)
Offline
Hey,
at first glance I'd say remove the "Gateway='10.1.1.1'" line from /etc/netctl/network-profile_vb-host-only_static
i'm sorry for my poor english wirting skills…
Offline
That worked perfectly. Thank you very much!
Offline
Please remember to mark the thread as solved https://bbs.archlinux.org/viewtopic.php?id=130309
Offline