LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-30-2014, 04:47 AM   #1
slacker_
Member
 
Registered: Aug 2013
Distribution: Arch, Debian, Slackware
Posts: 333

Rep: Reputation: 3
How do I route internet in from wlan0 and out through eth0 in debian/centOS?


I've tried doing this by blackboxing it, didn't work out well. Tried googling, and didn't come up with much of anything that was helpful.

Essentially I want to be able to take the internet access I have through wifi, and pass it through a traffic filter and out the ethernet connection to a switch or directly to another system. Ie, use my laptop to access the internet via wifi, and provide that access to another system(s) over ethernet. I'd prefer a method that doesn't require some third-party application, and doesn't rely on a GUI, to the extent possible.

I've never done anything like this so I'll really need a step by step, newbie-friendly format if that's doable.

I'm using debian on a thinkpad t60p, but I dualboot with centOS so being able to do it in both will be necessary.
 
Old 01-30-2014, 05:37 AM   #2
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18
I think below is relevant for you. For your case, eth1 at this document will be wlan0 I guess

http://www.cyberciti.biz/faq/rhel-fe...sharing-howto/
 
1 members found this post helpful.
Old 01-30-2014, 04:50 PM   #3
slacker_
Member
 
Registered: Aug 2013
Distribution: Arch, Debian, Slackware
Posts: 333

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by myatthu View Post
I think below is relevant for you. For your case, eth1 at this document will be wlan0 I guess

http://www.cyberciti.biz/faq/rhel-fe...sharing-howto/
So according to this, my internal is eth0 and external is wlan0?

Now, while this is brilliant, do you know if this method works for debian?
 
Old 01-30-2014, 08:03 PM   #4
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18
Yes. According to your initial post, eth0 is internal and wlan0 is wan.
For debian flavour, iptables rules are sane but network interfaces config file will be different.
Pls refer below excellent guide for debian flavour

http://www.debuntu.org/iptables-how-to-share-your-internet-connection/
 
1 members found this post helpful.
Old 01-30-2014, 08:20 PM   #5
slacker_
Member
 
Registered: Aug 2013
Distribution: Arch, Debian, Slackware
Posts: 333

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by myatthu View Post
Yes. According to your initial post, eth0 is internal and wlan0 is wan.
For debian flavour, iptables rules are sane but network interfaces config file will be different.
Pls refer below excellent guide for debian flavour

http://www.debuntu.org/iptables-how-...et-connection/
That's interesting that the same method won't work with debian because the "sysctl.conf" exists in debian as well. Do they do different things between the two OSes?
 
Old 01-31-2014, 03:26 AM   #6
slacker_
Member
 
Registered: Aug 2013
Distribution: Arch, Debian, Slackware
Posts: 333

Original Poster
Rep: Reputation: 3
Also, is there an easy was to, essentially, "turn on/off" the internet sharing? I'd like to be able to control it easily without deleting/re-adding rules and such.
 
Old 01-31-2014, 11:19 AM   #7
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18
This guide is specific for debian flavour.

http://chrisjrob.com/2011/03/14/shar...ethernet-port/

In order to automate or run as service, you just need basic script skill and can create custom init script.

PS: Pls thank to original writer for his good guide
 
1 members found this post helpful.
Old 01-31-2014, 02:37 PM   #8
slacker_
Member
 
Registered: Aug 2013
Distribution: Arch, Debian, Slackware
Posts: 333

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by myatthu View Post
This guide is specific for debian flavour.

http://chrisjrob.com/2011/03/14/shar...ethernet-port/

In order to automate or run as service, you just need basic script skill and can create custom init script.

PS: Pls thank to original writer for his good guide

Brilliant, thanks for the alternate guide.

As far as the init script, I'm not 100% sure what that script would need to do. I'm guessing the following:

Code:
[when first run]
test if the following is already in place{
bring the eth connection down, set to static ip
set the rules for iptables
uncomment the lines in /etc/dnsmasq.conf
}
[then when run again]

test if the above is running, and if so complete the following{
comment out the lines in /etc/dnsmasq.conf
remove/hide/disable the rules for iptables
bring eth down, reset to take dynamic ip
}
Is that right, or am I thinking about it incorrectly? I've never written a script like this, and an init script seems all the more complicated if I want to bring the sharing service up/down at will.
 
Old 01-31-2014, 06:56 PM   #9
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18
You can take a look /etc/rc.d/init.d directory for build in scripts for other services.
You can put your requirements accordingly.
 
  


Reply

Tags
centos, debian, eth0, routing, wlan0


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 10:54 AM
[SOLVED] Can't manage to set up a router (eth1 bridged w/ wlan0 connected to eth0 Internet) kummiliim Linux - Networking 3 09-12-2009 10:45 AM
CentOS 5.2: Only one of eth0 (internet) or eth1 (LAN) works Sinedie Linux - Networking 3 08-20-2008 05:52 AM
How can i choose network card (eth0 or wlan0) to connect to internet? Klas Linux - Networking 4 05-07-2004 05:36 PM
route wlan0 to eth0 hwood7587 Linux - Networking 1 07-13-2003 07:47 PM

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

All times are GMT -5. The time now is 10:11 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