Debian based server picks wrong network as gateway

1

1

I'm configuring own server to act as router. It has three interfaces, two cable and wifi.

Following this article to configure access point. After setting bridge i have problem with default gateway. System always chooses bridge as gateway what is wrong.

Interfaces are: eth0 -> link do my ISP (DHCP - dynamic address), eth1 -> internal network, wlan0 -> wifi.

eth1 and wlan0 are bridged.

Some data:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.22.11   0.0.0.0         UG    0      0        0 zbr0
192.168.11.64   0.0.0.0         255.255.255.192 U     0      0        0 eth0
192.168.22.0    0.0.0.0         255.255.255.128 U     0      0        0 zbr0


eth0      Link encap:Ethernet  HWaddr 54:be:f7:09:67:7a
      inet addr:192.168.11.77  Bcast:192.168.11.127  Mask:255.255.255.192
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:245 errors:0 dropped:0 overruns:0 frame:0
      TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:18860 (18.4 KiB)  TX bytes:1559 (1.5 KiB)
      Interrupt:20 Memory:f7e00000-f7e20000

eth1      Link encap:Ethernet  HWaddr 54:be:f7:09:67:7b
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:367 errors:0 dropped:0 overruns:0 frame:0
      TX packets:254 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:62760 (61.2 KiB)  TX bytes:37744 (36.8 KiB)
      Interrupt:18 Memory:f7c00000-f7c20000

lo        Link encap:Local Loopback
      inet addr:127.0.0.1  Mask:255.0.0.0
      UP LOOPBACK RUNNING  MTU:16436  Metric:1
      RX packets:2 errors:0 dropped:0 overruns:0 frame:0
      TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:190 (190.0 B)  TX bytes:190 (190.0 B)

zbr0      Link encap:Ethernet  HWaddr 54:be:f7:09:67:7b
      inet addr:192.168.22.11  Bcast:192.168.22.127  Mask:255.255.255.128
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:285 errors:0 dropped:0 overruns:0 frame:0
      TX packets:245 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:32960 (32.1 KiB)  TX bytes:35426 (34.5 KiB)

How to set gateway via interface not an IP address?

Interfaces configuration:

auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug eth1
iface eth1 inet manual

allow-hotplug wlan0
iface wlan0 inet manual

auto zbr0
iface zbr0 inet static
bridge_ports eth1
address 192.168.22.11
netmask 255.255.255.128
network 192.168.22.0
broadcast 192.168.22.127
gateway 192.168.22.11

WombaT

Posted 2013-12-01T14:35:54.223

Reputation: 215

Can you show us your /etc/network/interfaces configuration? – Marcus Rickert – 2013-12-01T14:50:26.130

added to question. – WombaT – 2013-12-01T15:00:38.367

I think it should suffice to delete the gateway entry in your interfaces file. Since you retrieve the IP address for eth0 over DHCP it should establish the default route through eth0 appropriately. – Marcus Rickert – 2013-12-01T15:24:15.543

Answers

2

Delete the default route that is in the routing table and replace it with something like route add default gw 192.168.11.1 eth0

canadmos

Posted 2013-12-01T14:35:54.223

Reputation: 442

Useless for me, IP address on eth0 is dynamic so i would have to change that route every time when it changes. – WombaT – 2013-12-01T15:01:50.603

1The address in that command is the actual gateway address. You are simply telling all packets not destined for a known network or host to be funneled out the eth0 interface, to the address specified in the command. Did you try it? – canadmos – 2013-12-01T15:31:27.603

Also, your interfaces file has the gateway set just as the routing table describes. – canadmos – 2013-12-01T15:34:40.790

Ok, my mistake, i thought that gateway parameter is for dhcp clients on that network. – WombaT – 2013-12-01T15:57:14.083