0

I'm in the middle of doing some testing on a mobile device, and want to test it from the network. The mobile device will only connect to networks via WiFi, and doesn't support ad-hoc mode, so I've set up an old WiFi router as an AP, which is connected via ethernet to a port on my laptop. The router operates under 192.168.0.0/24.

My laptop is also connected to our normal network via another ethernet port. This network operates under 10.0.2.0/24, and provides internet connectivity.

My laptop is running a VM which has two NICs, each bridged onto the two respective physical NICs. The 10.0.2.0 network is reachable via eth0, and the 192.168.0.0 network is reachable via eth1.

The problem I'm having is that all connectivity drops as soon as I run ifup eth1. I've tried changing routing tables and adapter metrics, but have had no luck.

Here's the output from ifconfig -a:

eth0      Link encap:Ethernet  HWaddr 08:00:27:04:7a:b7  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe04:7ab7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:18135 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11076 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:12226743 (12.2 MB)  TX bytes:1047606 (1.0 MB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:96:cf:1c  
          inet addr:192.168.0.5  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe96:cf1c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1803 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1439 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:166923 (166.9 KB)  TX bytes:118391 (118.3 KB)

Here's my routing table:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    100    0        0 eth1
0.0.0.0         10.0.2.2        0.0.0.0         UG    100    0        0 eth0
10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1

And the output from ip route:

default via 192.168.0.1 dev eth1  metric 100 
default via 10.0.2.2 dev eth0  metric 100 
10.0.2.0/24 dev eth0  proto kernel  scope link  src 10.0.2.15 
192.168.0.0/24 dev eth1  proto kernel  scope link  src 192.168.0.5 

Ideas? I'm not a Linux guy, so I'm stumped by this.


Edit:

# cat /etc/network/interfaces 

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet dhcp

auto eth2
iface eth2 inet dhcp

auto ath0
iface ath0 inet dhcp

auto wlan0
iface wlan0 inet dhcp

Output from ip route after dropping the eth1 default route:

default via 10.0.2.2 dev eth0  metric 100 
10.0.2.0/24 dev eth0  proto kernel  scope link  src 10.0.2.15 
192.168.0.0/24 dev eth1  proto kernel  scope link  src 192.168.0.5 
Polynomial
  • 259
  • 2
  • 9
  • Are you using VirtualBox? And are you absolutely certain that you used bridged networking in setting it up? This looks like you did not. You can't bridge to a wireless adapter this way anyway. – Michael Hampton Sep 24 '13 at 15:09
  • Yes, it's VirtualBox. Absolutely sure both are bridged. It's not a wireless adapter - both adapters are wired (just one happens to be connected to a WiFi AP device via Ethernet). – Polynomial Sep 24 '13 at 15:19
  • What are the contents of your eth1 configuration file? (`/etc/sysconfig/network-scripts/ifcfg-eth1` if you're in Red Hat Enterprise Linux or derivatives) – John Sep 24 '13 at 15:19
  • I don't have that file - it's BackTrack 5 so it's based on Ubuntu, rather than RHEL, I believe. – Polynomial Sep 24 '13 at 15:20
  • 1
    What do you mean by "all connectivity drops"? Also, your default routes both have the same metric. You might do better to not have a GW set on eth1 and to lose the default route out eth1. – TheCleaner Sep 24 '13 at 15:21
  • I mean that I can't get traffic out to the internet, via Chrome or Firefox, nor can I do DNS lookups. I've tried killing the default route for eth1 to no avail. As soon as I do `ifdown eth1` it works fine, but when I bring it back up connectivity dies again. – Polynomial Sep 24 '13 at 15:24
  • But it also brings back the default route when you do `ifup eth1` if configured improperly !!! please give us the content of `/etc/network/interfaces` – mveroone Sep 24 '13 at 15:28
  • Edited requested details in. – Polynomial Sep 24 '13 at 15:32
  • I'm not a Linux guy, but try seting eth1 as a static /24 with no GW IP. Then check your routing. – TheCleaner Sep 24 '13 at 15:48
  • I have no idea how to do that. – Polynomial Sep 24 '13 at 15:53

2 Answers2

1

I'm not as familiar with Debian, but what TheCleaner says is where I think your issue is. When you configured your eth1 interface, you added a "new" default route, which is interfering with your preexisting default route. If you remove that "default" route from eth1, you should be okay - I just don't know how to tell you to remove that config bit in a Debian-like OS.

John
  • 9,070
  • 1
  • 29
  • 34
  • I used `ip route del` to kill off the secondary route but am still facing the same issue - no connectivity to the internet via the 10.0.2.0/24 network. – Polynomial Sep 24 '13 at 15:25
  • Please update the output of `ip route` – mveroone Sep 24 '13 at 15:26
  • @Kwaio The only difference when I kill the route is that the top line disappears. When I do ifdown/ifup the line comes back. – Polynomial Sep 24 '13 at 15:29
  • The route changes should have fixed your internet connectivity. Once you get that working :p you can disable sending of the default gateway field in the dhcp server on the 192.168.0.0/24 network to get the conflicting route to not show up. – Daniel Widrick Sep 24 '13 at 16:25
  • @IVint67 The internet connectivity is absolutely fine when eth1 is down. The instant eth1 comes up everything dies. I can't change the DHCP server config though, it's a crappy old router with vendor firmware burned into it :( -- surely my removal of the route should've fixed that if it was the issue anyway? – Polynomial Sep 24 '13 at 16:28
0

Your problem is the DHCP. Even if you can't disable the server, you can choose to not ask him for an address and choose it yourself :

When eth1comes up, it automatically adds a second default gateway, which shouldn't be the default one, DHCP's fault.

You have to edit `/etc/network/interfaces, and change :

auto eth1
iface eth1 inet dhcp

by :

auto eth1
iface eth0 inet static
address 192.168.0.200
netmask 255.255.255.0

Note that there is no gateway specified, and '200' is choosed randomly, with the hope of being out of the DHCP range. Then you can do ifdown eth1/ ifup eth1.

If you still have problems at this point, please update the outputs of ifconfig, ip route -a and cat /etc/network/interfaces

mveroone
  • 474
  • 7
  • 22