Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 12-08-2008, 04:35 AM   #1
LQ Newbie
Registered: Dec 2008
Posts: 9

Rep: Reputation: 0
how can i set two lan cards in ubuntu server 8.10

hello all! i need some help pls...
here's the issue: i use ubuntu 8.10 server with two lan cards.

eth0 is set with static ip ( connected to my modem-router for access internet. this one goes fine...

eth1 is set also static ( connected to a switch for my clients (windows xp and ubuntu)

i have installed dhcp3 server in my server and cut off dhcp from the router.also works ok....server goes to internet,and my client gets dhcp ip address from the server.

the thing is that i cannot access the internet from my client...
and some times when i get connected to the client i cant access the internet from the server...

what is going wrong?
i tried changing gateway to the eth1 (from to 0.2) but no luck....

please anyone who can help? thanx a lot!
Old 12-08-2008, 05:20 AM   #2
LQ Newbie
Registered: Dec 2008
Location: Zuerich, Switzerland
Distribution: Fedora Core/Debian
Posts: 28

Rep: Reputation: 16
Did you put in Routes? So your Server knows does it has to forward all requests to the router?
Old 12-08-2008, 05:28 AM   #3
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 741

Rep: Reputation: 73
you need iptables to do a masquerade and enable "ip_forarding" in your server kernel.


iptables -A POSTROUTING -s -d ! -o eth0 -j MASQUERADE

echo "1" > /proc/sys/net/ipv4/ip_forward

Something like this will allow eth1 to go through eth0.

Good luck!
Old 12-08-2008, 08:34 AM   #4
LQ Newbie
Registered: Dec 2008
Posts: 9

Original Poster
Rep: Reputation: 0
well thanx for your help folks!!! one more thing...

as anwser to i didnt do such a thing...

and i have to download anything (like iptables or somothing?) to do it?
Old 12-08-2008, 08:55 AM   #5
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 741

Rep: Reputation: 73
iptables should be already in the system, thats it. just try it and see what happens.

in case of some problems just run: iptables -F to flush all rules.
Old 01-02-2009, 10:18 PM   #6
LQ Newbie
Registered: Jan 2009
Posts: 5

Rep: Reputation: 0
NAT Configuration in Ubuntu Server 8.10

Set your static IP configurations on eth0 and eth1.
Make eth0 your primary or outside interface.(internet) Set eth1 to desired address pool to be used as the default route for dhcp clients.(switch) Do not specify a default gateway for eth1, only eth0.
Edit these settings in the /etc/network/interfaces
See example below:

# The primary network interface (Public)
auto eth0
iface eth0 inet static

# The secondary network interface (Private)
auto eth1
iface eth1 inet static

Now configure your DHCP settings accordingly. Here is what I did:

Uncomment: server-identifier "hostname";

subnet netmask {
option domain-name-servers;
option domain-name "hostname";
option routers;
option broadcast-address;
default-lease-time 600;
max-lease-time 7200;

Now you should be able to pick up addresses from your server; however, clients connected will not have internet access. This is because NAT is not enabled. Linux or in this case Ubuntu calls this masquerading.

Two lines of code does this for us, however, it must be run in a script every time the server starts up.

echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Run the two above lines for testing. Remember to prefix with sudo to run as root if you aren't logged in as root.

If all is well, add the lines to /etc/rc.local and then add the file to start at boot by running:

chmod +x /etc/rc.local

Test by restarting and release renewing a client and checking for internet access.

Worked for me so I hope this works for you.

Let me know how it goes or if you have more questions.



lan, multiple

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
Set up LAN DNS server rockymaxsource Linux - Networking 1 07-19-2007 06:09 PM
NFS server running on a machine with two Lan cards cafun4o Linux - Networking 2 01-22-2007 11:14 AM
LXer: How To Set Up A DHCP Server For Your LAN LXer Syndicated Linux News 0 09-24-2006 07:54 AM
How do I set up a server on a lan? Terry M Linux - Newbie 1 02-20-2005 12:23 AM
DHCP server on two LAN cards V.krishna kumar Linux - Networking 3 10-24-2002 01:57 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:13 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration