LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-08-2008, 03:35 AM   #1
machinakias
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 (192.168.0.2) connected to my modem-router for access internet. this one goes fine...

eth1 is set also static (192.168.0.3) 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 192.168.0.1 to 0.2) but no luck....

please anyone who can help? thanx a lot!
 
Old 12-08-2008, 04:20 AM   #2
Nibbl3r
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, 04:28 AM   #3
robertjinx
Member
 
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 749

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

example:

iptables -A POSTROUTING -s 192.168.0.3/255.255.255.0 -d ! 192.168.0.3/255.255.255.0 -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, 07:34 AM   #4
machinakias
LQ Newbie
 
Registered: Dec 2008
Posts: 9

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

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

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

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, 09:18 PM   #6
nausser
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
address 87.65.23.70
netmask 255.255.255.224
network 87.65.23.64
broadcast 87.65.23.95
gateway 87.65.23.65

# The secondary network interface (Private)
auto eth1
iface eth1 inet static
address 192.168.3.1
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255

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

Uncomment: server-identifier "hostname";

subnet 192.168.3.0 netmask 255.255.255.0 {
range 192.168.3.2 192.168.3.254;
option domain-name-servers 192.168.3.1;
option domain-name "hostname";
option routers 192.168.3.1;
option broadcast-address 192.168.3.255;
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.

-Nausser
 
  


Reply

Tags
lan, multiple



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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