LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-28-2013, 07:39 AM   #1
Elie Dac
LQ Newbie
 
Registered: May 2013
Location: France
Distribution: Fedora
Posts: 1

Rep: Reputation: Disabled
Redirect two different networks wlan0/eth0


Hi all,

I am really a newbie, so this can look like a basic question, however I still have not found the answer googling it.

I can access two different networks:
* One from my company using eth0
* Another one in wifi using wlan0

The main idea is to be able to correctly use both interfaces at the same time.
Because with the eth0 interface, I cannot access the network outside my company, and with wlan0 I cannot access the network inside my company

So I want to be able to access some domains in both networks.

Usually, I connect wlan0 using the network manager:

Code:
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.46  netmask 255.255.255.0  broadcast 192.168.1.255
Then, I manually set a static IP for eth0:
Code:
sudo ifconfig eth0 10.45.121.21 netmask 255.255.254.0 broadcast 10.45.121.255
Now, my route table:
Code:
sudo ip route

default via 192.168.1.1 dev wlan0  proto static
10.45.120.0/23 dev eth0  proto kernel  scope link  src 10.45.121.21
192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.46
Because, all IP adresses on my company starts with 10.*, I replace the current gateway (it may be a bad idea):

Code:
sudo ip route del 10.45.120.0/23
sudo ip route add 10.0.0.0/8 dev eth0  proto kernel  scope link  src 10.45.121.21
So my route table looks like this:

Code:
sudo ip route

default via 192.168.1.1 dev wlan0  proto static
10.0.0.0/8 dev eth0  proto kernel  scope link  src 10.45.121.21
192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.46

Finally my /etc/resolv.conf:
Code:
# Generated by NetworkManager
nameserver 192.168.1.1
This way, I can ping IP addresses that begin with 10.*.
I can also ping google.com.
But as my resolv.conf suggests, I am not able to ping a domain on the 'eth0' network, so this is kind of annoying.
I already know that if I set eth0 as the default network using the Network manager, the resolv.conf is:

Code:
# Generated by NetworkManager
nameserver 10.45.20.3
So I was hoping that maybe someone had a better idea setting the two networks together more easily
 
Old 05-30-2013, 06:12 PM   #2
MikeDeltaBrown
Member
 
Registered: Apr 2013
Location: Arlington, WA
Distribution: Slackware
Posts: 96

Rep: Reputation: 10
I'm not familiar with NetworkManager but there must be a way to add another 'nameserver' line. You'll need to put 192.168.1.1 back into the file.
<checking>...
Looks like you add these lines to the relevant interface file:
In ifcfg-wlan0 add:
DNS1=192.168.1.1
and in ifcfg-eth0 add:
DNS1=10.45.20.3

This from: https://live.gnome.org/NetworkManager/SystemSettings under Nameserver section about half way down.

Last edited by MikeDeltaBrown; 05-30-2013 at 06:17 PM. Reason: file name correcctions
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
eth0 and wlan0 vs wlan0 problem player107 Linux - Wireless Networking 3 02-25-2013 09:54 AM
No networks at all (eth0, wlan0) arsci Linux - Networking 1 09-11-2010 02:48 AM
how to forward wlan0 to eth0? patcito Linux - Networking 2 07-03-2009 05:26 AM
Starting wlan0 instead of eth0 eo697 Linux - Networking 2 10-12-2003 05:02 PM
route wlan0 to eth0 hwood7587 Linux - Networking 1 07-13-2003 06:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration