LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Internet over wireless while connected to a LAN network (https://www.linuxquestions.org/questions/linux-networking-3/internet-over-wireless-while-connected-to-a-lan-network-4175490885/)

karnage219 01-10-2014 08:17 PM

Internet over wireless while connected to a LAN network
 
Linux Newbie here, this is most likely a simple fix by anybody with experience. I am using Ubuntu 12.10. I can provide more details if needed.

I am having some trouble connecting to the internet and my lan network at the same time. I am connected wirelessly to my internet network, I am also hard wired into a home network that is not connected to the internet. While my lan is active i cannot connect to the internet, only to my network. If i disable my wired connection my wireless connection automaticly takes priority and i can connect to the internet again. I am woundering how to route my internet trafic through my wireless connection while still being able to connect to my wired network.


Also, i am currently updating to the most recent Ubuntu

jrosco 01-10-2014 09:18 PM

Hi, My guess would be you have 2 default routes when both connections are enabled. To check this you should open a terminal .e.g gnome-terminal and ran sudo route -n and check if you have 2 default routes e.g.

0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 wlan0
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 eth0

If so you need to remove the default route from the wired interface e.g eth0 if your using a static ip. If your using dhcp on the wired interface I suggest you setup a static ip via the /etc/network/interfaces file (example below)

Code:

auto eth0
iface eth0 inet static
address 192.168.0.103
netmask 255.255.255.0
broadcast 192.168.0.255

You'll have to restart the network service after adding modifying the network file

Code:

sudo /etc/init.d/networking restart
Hope this helps.

Joel

karnage219 01-10-2014 11:01 PM

I dont seem to have two defaults, wlan1 seems to just be a lower priority then eth0, and I dont understand how to change that.

This is when just my wireless interface is active


Destination*****Gateway*********Genmask*********Flags*Metric*Ref****Use*Iface
0.0.0.0**********192.168.0.1******0.0.0.0***********UG*****0******0********0 wlan1
192.168.0.0****0.0.0.0************255.255.255.0****U******9******0********0 wlan1



This is while both my wireless and wired connections are active


Destination*****Gateway*********Genmask*********Flags Metric Ref****Use Iface
0.0.0.0**********172.16.42.1*****0.0.0.0*************UG****0******0********0 eth0
169.254.0.0*****0.0.0.0**********255.255.0.0********U*****1000**0********0 eth0
172.16.42.0*****0.0.0.0**********255.255.255.0*****U*****1******0********0 eth0
192.168.0.0*****0.0.0.0**********255.255.255.0*****U*****9******0********0 wlan1

jrosco 01-10-2014 11:31 PM

Is eth0(172.16.42 network) interface receiving its ip settings from a dhcp server? If so, try disabling the gateway from your dhcp server settings..... other then that and not knowing the complete layout of your network that's all I can think of.

Also run this :

Code:

sudo cat /etc/network/interfaces
And post the output here.

Joel

karnage219 01-11-2014 12:06 AM

Quote:

Originally Posted by jrosco (Post 5095873)
Is eth0(172.16.42 network) interface receiving its ip settings from a dhcp server? If so, try disabling the gateway from your dhcp server settings..... other then that and not knowing the complete layout of your network that's all I can think of.

Also run this :

Code:

sudo cat /etc/network/interfaces
And post the output here.

Joel



Im not sure about the dhcp server, i dont belive it is.
Also, /etc/network/interface is mostly empty

Code:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback


jrosco 01-11-2014 12:33 AM

try adding eth0 as a static ip

following this guide:
http://www.sudo-juice.com/how-to-a-s...-ip-in-ubuntu/

and leave the gateway out, if the interface eth0 doesn't need internet access theres no need for it.

karnage219 01-11-2014 01:13 AM

Ok, i set up the wired connection as a static ip but my wired is still set to default, while my wireless is not default.

jrosco 01-11-2014 01:59 AM

Have you done a reboot?

karnage219 01-11-2014 02:09 AM

Quote:

Originally Posted by jrosco (Post 5095917)
Have you done a reboot?


Yes, also I somehow got it to work temporarily using
Code:

route add default GW 192.168.0.1 wlan1
The problem is that this is said to only hold true until a reboot. I need it to permanently stay like this.

Ifconfig still gives the eth0 a metric of 0 and wlan1 a metric of 9. Nm-tool shows eth0 as default and wlan1 as non default.

jrosco 01-11-2014 02:31 AM

The dirty and nasty way to permanently add that command at startup is the following

sudo echo "route add default GW 192.168.0.1 wlan1" >> /etc/rc.local

then
Code:

cat /etc/rc.local
and ensure that command is on the last line. Now reboot and see if that helps.

I'm not sure why the default gateway keeps appearing on the eth0.


All times are GMT -5. The time now is 07:44 AM.