how to set the default gateway (/etc/network/interfaces ?)

Rashkae ubuntu at tigershaunt.com
Thu Mar 7 19:47:39 UTC 2013


On 03/07/2013 08:43 AM, Thufir Hawat wrote:
> Is the default gateway *only* in /etc/network/interfaces or can that be
> set elsewhere?  By set I mean stored to a file, persisting.
>
> In trying to use an IOGear wireless bridge, the settings showed a bit
> odd.  In the Access Point status section, when connecting to the bridge
> at 192.168.1,252, ie the gateway, there was:
>
> Channel Number      11
> Encryption      WPA2
> BSSID   70:54:d2:36:b7:05
> Status  Connected
> TCP/IP Configuration
> Attain IP Protocol  Fixed IP
> IP Address  192.168.1.252
> Subnet Mask     255.255.255.0
> Default Gateway     0.0.0.0
> DHCP Server     Disabled
> MAC Address     00:21:79:c6:5a:de
>
> http://askubuntu.com/a/265056/45156
>
>
> and I found that default gateway setting confusing because I had set the
> gateway as so:
>
>
> thufir at dur:~$
> thufir at dur:~$ cat /etc/network/interfaces.static
> # This file describes the network interfaces available on your system
> # and how to activate them. For more information, see interfaces(5).
>
> # The loopback network interface
> auto lo
> iface lo inet loopback
>
> # The primary network interface
> auto eth0
> iface eth0 inet static
> address 192.168.1.100
> netmask 255.255.255.0
> gateway 192.168.1.252
>
> # The secondary network interface
> auto eth1
> iface eth1 inet dhcp
> thufir at dur:~$
>
>
> and so I don't see why the default gateway should be 0.0.0.0, this makes
> no sense.  Particularly given that simply switching the wires over to
> connect the bridge to a router, rather then the computer, works fine.
> (And, the router is even set to DHCP -- or maybe that's the solution??)
>

I'm not familiar with IOGear wireless bridge in particular.  Sometimes, 
terminology is used loosely and that can leave me confused (routers that 
don't route?  More common than you might think :)

Disclaimer aside, a bridge is not a router, and therefore, not gateway. 
  The bridge requires it's own IP address so you can log in the web 
interface and change settings, but traffic between the wireless and 
wired portion of the network should seamlessly cross over.

Therefore, the gateway should be the same gateway you get when connected 
to your wired network.  Probably 192.168.1.1  This is assuming your 
wired network is on the same subnet.

For that matter, if the bridge is working properly, you should be able 
to use dhcp on eth0 when connected to it, same as normal.

Speaking of subnets, since you are using static IP's.. 192.168.1.100 and 
192.168.1.252, you need to verify that those IP's are not being used by 
your Router/NAT/DHCP pool.  the .100 probably is.  You'll have to verify 
on the router interface what the DHCP settings are.  Normally, a range 
of 50 to 100 IP's are specified. (for example, 192.168.1.100 to 
192.168.1.150, in which case static IP's should either be bellow 100 
(but not 0, and 1 is probably used by the router itself) or above 150)


Looking over the details you posted on the ask ubuntu, I'm even more 
confused about what you are trying to do.  (wireless bridge plugged into 
network port of router,?)

Also, configuring a gateway in your workstation is not going to 
configure a gateway in the wireless bridge.  Which is fine, chances are 
the wireless bridge doesn't need a gateway at all.

I think I'll need very detailed explanation of how you are trying to set 
up your network, complete with diagrams, to try and make sense of things 
here.




More information about the ubuntu-users mailing list