LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How to add a static route to wired router without dropping wifi internet. (https://www.linuxquestions.org/questions/linux-networking-3/how-to-add-a-static-route-to-wired-router-without-dropping-wifi-internet-4175458675/)

captdavid1949 04-18-2013 02:52 PM

How to add a static route to wired router without dropping wifi internet.
 
Trying to educate myself on network routing and have run into a problem I think I know the solution to, just don't know how to fix it. Explantions found in searches are way past my learning curve.

Fedora 17 (Xfce4.10)
(wlan0) Wireless nic used for internet gateway
Reserved DHCP address 192.168.1.3
Gateway address 192.168.1.1

(em1) wired network card
Presently no assigned ip address
Want to connect to another wireless router via ethernet
Gateway address 192.168.2.1

A little history... figured out in order to connect to both routers at the same time,I needed to change the ip of the wired router, and that went ok. Problems start when I leave the wired router configured as a DHCP server. If I connect to the wired lan, I loose the internet routing on the wireless lan. Disconnect from the wired lan and it's back. Not loosing the wireless connection just the internet path. Assume Fedora is assigning higher priority to the wired DHCP server and looking for a path to the internet which doesn't exist.

Ok, disable DHCP on the wired router. Problem is now the "Network Connections Manager" is asking the router for an address, which it cannot supply.

Assume I need to set up a "static route" on both my box and the wired router so they can find each other. Don't mind futzing with the settings on the router (Love that reset button) but am more than a little leery about messing with etc/sysconfig files without a little guidance.

The Fedora documentation is a little dense, so any pointers would be appreciated.

TIA

----------Edit------------
After some additional searching tried the following with both networks connected and DHCP running on both
Code:

[david@wilson ~]$ route -n
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
0.0.0.0        192.168.2.1    0.0.0.0        UG    0      0        0 em1
192.168.1.0    0.0.0.0        255.255.255.0  U    0      0        0 wlan0
192.168.2.0    0.0.0.0        255.255.255.0  U    0      0        0 em1

[david@wilson ~]$ sudo route del default gw 192.168.2.1
[david@wilson ~]$ sudo route add default gw 192.168.1.1

[david@wilson ~]$ route -n
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
0.0.0.0        192.168.1.1    0.0.0.0        UG    0      0        0 wlan0
192.168.1.0    0.0.0.0        255.255.255.0  U    0      0        0 wlan0
192.168.2.0    0.0.0.0        255.255.255.0  U    0      0        0 em1

Thought I had a (temporary) solution. However running
ping google.com
resulted in a return from 192.168.2.0 not google's ip (?) No internet access as before
despite the right gateway

The search continues grasshopper..

captdavid1949 04-18-2013 07:53 PM

Solved... sort of
 
Simple.. but like the jitterbug it plumb evaded me.

In network manager edit the current wired connection and change from "Automatic"
to Automatic (DHCP) Addresses only
Save and exit

Open Terminal
# route del default gw xxx.xxx.xxx.xxx (wired connection gateway)
# route add default gw xxx.xxx.xxx.xxx (wireless connection gateway)

Done! Internet access available with both networks up, running DHCP.

Note: Found this to work only until I disconnected from wired network. Upon reconnection default gateway reverted to wired network. Work around is as follows:

Open file /etc/sysconfig/network-scripts/ifcfg-[my-wired-connection-name]
Change Entries DEFROUTE=yes and IPV6_DEFROUTE=yes to =no
Save changes

"Your Mileage May Vary" as I have probably done a bunch of things that ain't right, but it works for me.


David


All times are GMT -5. The time now is 02:21 AM.