Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 05-19-2007, 02:53 PM   #1
Registered: Aug 2006
Location: Mississauga, Ontario, Canada
Distribution: RHEL 5, CentOS 5
Posts: 64

Rep: Reputation: 15
Private LAN accessing the Internet - Using route, how do I use it?


I have 2 Ethernet cards. 1 is public ( with a gateway of and a private card with ( I want to route traffic from computers on the private LAN to the internet. How do I do this?

So I have a computer say connected to the network. I can ping the server but I can ping outside to the Internet. Can you provide steps on how I can achieve this?

Old 05-19-2007, 03:54 PM   #2
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Assuming the gateway is set up to forward packets from the local net to the Internet, then on the private network machines you just need to do:

route add default gw

(puyt it in your network setup scripts so you don't have to rerun it aty every reboot).

If the gateway is not set to forward packets look for a Linux IP masquerading / NAT howto. It's pretty simple to set up.
Old 05-19-2007, 04:21 PM   #3
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681
Enter in "route" with no arguments to get a list of the routes. There should be one for each network ( and ) as well as the default route.

If the gateway device isn't a NAT router, then you need to configure masquerading and enable ip forwarding.

Your distro's gui configuration program may be able to set this up for you. It may be called internet sharing in the config.

You may need to also modprobe the tcp_conntrack module before ip forwarding will work.


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
Using vnc client & server from private LAN across internet swcng2001 Linux - Networking 5 09-05-2006 09:07 AM
cannot reach internet from private LAN toodr Linux - Networking 12 10-23-2005 08:44 PM
Setting up gateway to share internet for private LAN muru Linux - Networking 6 09-17-2005 09:08 PM
Route a private LAN with 1 NIC freelinuxcpp Linux - Networking 4 11-01-2003 06:05 AM
route to alcatel modem/router: LAN & internet HerrBee Linux - Networking 0 06-11-2003 03:16 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:11 PM.

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