LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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
 
LinkBack Search this Thread
Old 09-11-2006, 03:01 PM   #1
ssalman
LQ Newbie
 
Registered: Jun 2005
Location: USA
Distribution: Ubuntu 6.06
Posts: 18

Rep: Reputation: 0
Problem with internet sharing through a router


I’m trying to setup a firewall/filtering PC for a local network, but I hit a wall being not able to share the internet connection through my router. Here is the setup: I have a PC with Ubuntu installed and 2 NICs. I’m using the below commands to enable NAT, and I have installed and configured dnsmasq to do the DNS and DHCP.

Code:
$sudo iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
$sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
Now this setup works great when I directly connect another PC to my firewall/filtering PC using a crossover cable. But when I connect my router instead of the PC I can’t get to the internet, here is what I tried so far:

- Connecting the firewall/filtering PC to the router using a crossover cable to the internet/wan port on the router. This gave me a connected light on the router, but still no internet connection in the router setup screens (http://192.168.2.1) or through the router using other PCs. I could not ping PCs across the router either.

- Connecting the firewall/filtering PC to the router using a regular cable to one of the LAN ports on the router. This did not give me a connection light on the router, however I was able to ping both PC across the router. But still with no connection to the internet.

I know my problem lays between the router and my firewall/filtering PC, what am I doing wrong?

Thanks for all your help in advance.

Last edited by ssalman; 09-11-2006 at 03:20 PM.
 
Old 09-11-2006, 03:40 PM   #2
Caeda
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Suse 6.0+, Mandrake 5.0-10.0, Redhat 6.0-9.0, Gentoo 1.2+, Gnoppix, Knoppix, Sabayon, Ubuntu 5.04+
Posts: 1,811

Rep: Reputation: 45
*edited after I re-read your post*
Toss out the crossover cable. And throw out the dns and dhcp software.
Plug the second network card, and all the other computers into the router in the normal pc ports, don't even use the one labeled for an internet connection.
Load up some cheap/free proxy software on the firewall/filter pc, and have the other computers connect to the internet through your proxy. The router can handle the dhcp and setting up the net for you this way, and you can keep track of the traffic that is requested of your proxy.

Last edited by Caeda; 09-11-2006 at 03:42 PM.
 
Old 09-11-2006, 10:12 PM   #3
ssalman
LQ Newbie
 
Registered: Jun 2005
Location: USA
Distribution: Ubuntu 6.06
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Caeda
Load up some cheap/free proxy software on the firewall/filter pc, and have the other computers connect to the internet through your proxy.
I'll give it a try this week and report back. Thanks for your help Caeda!
 
Old 09-18-2006, 09:46 AM   #4
ssalman
LQ Newbie
 
Registered: Jun 2005
Location: USA
Distribution: Ubuntu 6.06
Posts: 18

Original Poster
Rep: Reputation: 0
Well, it took some time, but I got it to work finally. I still have a small problem, but more on that later…

I installed tinyproxy, and after tinkering with its configuration files, I’m now able to share my filtered internet connection through the router I will play with it some more to figure out all what I need, but I think I have got my self a solution, THANKS Caeda!!

Now for the problem: because I have two NICs on my proxy PC, two servers answer DHCP requests: the DSL modem, and my router, and they overwrite each others DNS and routing table info. so my internet connection get messed up.

I tried to setup /etc/iftab so that I have the eth1 and eth2 fixed and not switching around every boot (which worked so far) and then setup /etc/network/interfaces so that only my modem facing NIC will use DHCP, while the router facing NIC uses static IP setup, still it didn’t work, I had to disconnect my router and lunch dhclient and reconnect my router when finished in order to fix the internet connection. Another reason I want a static ip on the router facing NIC is that I don't want to change my browser settings everytime the IP address change.

What can I do to fix this issue?


Thanks
 
Old 09-19-2006, 09:38 AM   #5
ssalman
LQ Newbie
 
Registered: Jun 2005
Location: USA
Distribution: Ubuntu 6.06
Posts: 18

Original Poster
Rep: Reputation: 0
Found the problem... it was the DNS settings being overwritten by the last NIC being brought up, so I switched the eth numbers in iftab where the NIC facing the DSL modem (the one with DHCP) being last, and the one with static IP (the NIC facing the router) being first, and so the modem will dictate the DNS settings… works like a charm.
 
  


Reply

Tags
connection, internet, sharing


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem sharing files with Netgear Router RP614 linuxian Linux - Networking 6 06-29-2009 05:31 AM
Sharing internet connection (DSL router) betweeen two machines vharishankar Linux - Networking 7 12-15-2005 05:20 AM
Internet sharing through router Pyr00 Linux - Networking 17 02-28-2005 01:59 PM
DSL Ethernet USB Combo Router + Internet Sharing kenny_zzz Linux - Networking 0 02-28-2004 03:05 AM
Sharing Internet through Linksys Router ! SuseBoy Linux - Networking 2 09-01-2003 02:09 PM


All times are GMT -5. The time now is 02:12 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration