Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I run Linux Mint 17 on a desktop PC. My adsl router is too far away to connect by cable, so I have a USB wireless adaptor to communicate with it. I also have a wired ethernet router alongside the computer into which I can plug my NAS box, printer and laptop.
I would like to be able to surf the net, and keep the NAS box on-line, but cannot presently achieve it. Using NetworkManager to disable the wired interface, I can reach the internet, but not my wired hosts; and vice versa if I enable eth0.
My wireless router gives out, via its dhcp server, an address of 192.168.0.2
My wired router gives out, via its dhcp server, an address of 192.168.1.2
With the wired interface disabled, the output of the route command is:
Code:
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.1 0.0.0.0 UG 0 0 0 wlan0
192.168.0.0 * 255.255.255.0 U 9 0 0 wlan0
with the wired interface enabled, I get:
Code:
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
192.168.0.0 * 255.255.255.0 U 9 0 0 wlan0
192.168.1.0 * 255.255.255.0 U 1 0 0 eth0
I would like to make the wlan0 interface the default for all IP requests outside the range 192.168.1.0 to 192.168.1.255 (i.e. the internet). Is there a way to do this? I've tried various commands to 'route' but can never get the default to stick to the wlan0 interface AND have eth0 available.
Last edited by jnbb; 10-03-2014 at 06:30 AM.
Reason: Partial solution discovered
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Because your wired router issues a DHCP address including a default GW.
Either configure your desktop manually (IP, netmask, DNS, default GW) or tell your wired router to set the default gw to your wireless router. Sometimes the default GW cannot be set as DHCP option so then you must configure it manually.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
If it is true what you say --you cannot configure the wired DHCP def gw-- then there is no solution. Because it means that the wire DHCP server will always give out the def gw pointing to it self. So you get an IP, you get the def gw for free.
Networkmanager won't help you here. You cannot accept a dynamic address but ignore the def gw.
It assignes a default gw to eth0 while it is still using DHCP to acquire an IP. I am not sure it will work. If it works, the manual specification seems to have preference over the DHCP. It is worth a try.
Note however that when you mention eth0 in network/interfaces, it will not be managed anymore by networkmanager. You can leave you wlan0 in networkmanager though.
The problem is you have two separate networks, one with internet access, one without. You should look into a way to simplify things - one network, one "main" router, and the other can just act as a bridge. You can't run a single cat 5e/6 cable through the wall from your dsl router to the other router? If you can pull that off, then you can switch off DHCP on your other router so it just acts like a switch and everything is controlled by the dsl router.
As I understand DHCP, neither the offer packet DHCPOFFER nor the acknowledgement packet DHCPACK define the default gateway (Wikipedia: http://en.wikipedia.org/wiki/Dynamic...ation_Protocol ). Of course they define a gateway IP address GIADDR, otherwise the DHCP broadcast appeal wouldn't know who to talk to. But the default 0.0.0.0 is being assigned after the interfaces have got their IP addresses, and indeed the 'route' man page makes it clear that a static address must exist before it can be used as the default.
How is the default gw assigned? The man pages for 'ip', 'route', 'ifconfig' and 'dhcpd' do not mention this.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Well, I really think that DHCP assigns the default gw. Below is a snippet from my own DHCP server. And I am pretty sure that when I need to assign a different default gw, I do it here. Done that before.
About abandoning networkmanager. When you describe an interface in /etc/network/interfaces NM doesn't use it. So that would only be eth0. You can still have NM handle wlan0 which I would really recommend.
jlinkels - I understand. Because I cannot control this setting on my router via its web interface, I will enter the wired interface in /etc/network/interfaces, and will keep NetworkManager for wlan0 as you suggest.
One day I'll have a go at installing dd-wrt on the router (an ancient Netgear WGR614) and wrestle back control of it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.