LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-12-2007, 09:31 AM   #1
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 538

Rep: Reputation: 30
Cool Setting up a server with 2 network cards & ADSL


OK Linux people I need help -- again!

I've got a nice server set up here that does just what I need it to, except it's become unreliable. So, I'm replacing it. This server has been running for about 3 years now.

I am currently preparing its replacement. The new server has Ubuntu 6.10 with kernel 2.6.17.

Both servers have 2 network cards, one connects to the LAN switch (eth1) and one connects to the ADSL modem. (eth0).

Three years ago when I set up the current server. I wrote down what I did. One of my instructions was "configure eth0 NOT to come up at boot time" but I can't remember how I did this.

Old server works great. Eth1 takes care of the LAN, and eth0 is used as ppp0 and connects to the ADSL on boot.

New server, has all kinds of routing table problems, and ifconfig shows Eth1, Eth0 AND ppp0 when connected.

I think if I can just figure out how to get the eth0 to stay down, it would solve some problems. Just typing "ifconfig eth0 down" results in ppp0 not being able to connect.

A little help?
 
Old 03-12-2007, 03:09 PM   #2
Gzou
Member
 
Registered: Apr 2006
Location: Quebec, Canada
Distribution: Xubuntu, Zenwalk, Slax, Gentoo
Posts: 39

Rep: Reputation: 16
Umm I'm a little confused. Why would you want eth0 to stay down ?

it's a bit normal that ppp doesn't work when you do a "ifconfig eth0 down" since ppp uses eth0 to connect with your ADSL modem. no eth0, no ppp, no internet.

one way I know of to stop eth0 from being hotplugged by udev at boot (although I don't know how this can help you) is to:

edit /etc/conf.d/rc (using something like vim or nano)

look for RC_PLUG_SERVICES="" in the file and add "!net.eth0" in the quotes. So it would look like :

RC_PLUG_SERVICES="!net.eth0"

should work, although i've never tried it on my ubuntu.

Also, posting a few error messages like the one that tells you about the routing table problems might help.
 
Old 03-12-2007, 05:30 PM   #3
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 538

Original Poster
Rep: Reputation: 30
Well I don't want eth0 to up at boot because then it gives itself an IP address rather than using ppp0.

And, my route table is all messed up somehow.

My main problem is I am swiching distros from Mandrake (RPM based kernel 2.4) to Ubuntu (Debian based, kernel 2.6) so all my config files from Mandrake are useless.

For example my configuration on my existing Mandrake server is as follows:

/etc/sysconfig/network-scripts/ifcfg-eth0
Code:
DEVICE=eth0
USERCTL=no
ONBOOT=no
BOOTPROTO=dhcp
IPADDR=
NETMASK=
NETWORK=0.0.0.0
BROADCAST=255.255.255.255
DHCP_CLIENT=/sbin/dhclient
/etc/sysconfig/network-scripts/ifcfg-eth1
Code:
DEVICE=eth1
USERCTL=no
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.1
NETMASK=255.255.255.0
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
DHCP_CLIENT=/sbin/dhcpcd
ifconfig (Mandrake)
Code:
eth0      Link encap:Ethernet  HWaddr 00:09:6B:63:15:4E
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1428644 errors:5404 dropped:0 overruns:0 frame:0
          TX packets:1301018 errors:0 dropped:0 overruns:0 carrier:0
          collisions:5404 txqueuelen:100
          RX bytes:1270698349 (1211.8 Mb)  TX bytes:227804479 (217.2 Mb)
          Interrupt:24 Memory:fbff0000-fc000000

eth1      Link encap:Ethernet  HWaddr 00:09:6B:63:15:4F
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1235481 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1529784 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:236154610 (225.2 Mb)  TX bytes:1451267485 (1384.0 Mb)
          Interrupt:25 Memory:fbfe0000-fbff0000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:499685 errors:0 dropped:0 overruns:0 frame:0
          TX packets:499685 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:49578901 (47.2 Mb)  TX bytes:49578901 (47.2 Mb)

ppp0      Link encap:Point-to-Point Protocol
          inet addr:XXX.XXX.XXX.XXX  P-t-P:XXX.XXX.XXX.XXX  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:15 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:3318 (3.2 Kb)  TX bytes:342 (342.0 b)
Notice eth0 DOES NOT HAVE AN IP ADDRESS.

Of course on Debian everything is done differently.

I found a file /etc/network/interfaces wich I assume does what my above files do, but the syntax is all different:
Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

auto dsl-provider
iface dsl-provider inet ppp
provider dsl-provider

    pre-up /sbin/ifconfig eth0 up # line maintained by pppoeconf
As you can see my eth1, which I would like it to be a static IP address (not configured to be static yet) is not even listed.

Here is my Ubuntu ifconfig:
Code:
eth0      Link encap:Ethernet  HWaddr 00:10:18:24:C9:4B
          inet addr:192.168.1.198  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::210:18ff:fe24:c94b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8975 errors:13 dropped:0 overruns:0 frame:0
          TX packets:6348 errors:0 dropped:0 overruns:0 carrier:0
          collisions:13 txqueuelen:1000
          RX bytes:11856108 (11.3 MiB)  TX bytes:595537 (581.5 KiB)
          Interrupt:90

eth1      Link encap:Ethernet  HWaddr 00:14:5E:20:32:02
          inet addr:192.168.1.199  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::214:5eff:fe20:3202/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:16837 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16763 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1520865 (1.4 MiB)  TX bytes:14536916 (13.8 MiB)
          Interrupt:177

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:10793 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10793 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3579997 (3.4 MiB)  TX bytes:3579997 (3.4 MiB)

ppp0      Link encap:Point-to-Point Protocol
          inet addr:XXX.XXX.XXX.XXX  P-t-P:XXX.XXX.XXX.XXX  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:8912 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6490 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:11614467 (11.0 MiB)  TX bytes:441069 (430.7 KiB)
Everything works great in Mandrake, but in Ubuntu I have a helluva time, from the server I can access EITHER the Lan OR the Internet via Lynx but not both at the same time, and the LAN cannot access the Internet, but sometimes it can if I mess with the route command enough.... I also have to do pon and poff several times before it works. So I think if I could configure it the way I have Mandrake, it would work. My belief is that eth0 and ppp0 are arguing. I have to do route add commands. Here is my routing tables

Mandrake
Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
XXX.XXX.XXX.51  0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         XXX.XXX.XXX.51  0.0.0.0         UG    0      0        0 ppp0
Ubuntu
Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
64.230.197.51   0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 ppp0
 
Old 03-13-2007, 08:01 AM   #4
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
There are 2 problems in your /etc/network/interfaces that are not configured and therefore causing problems with your routing. The first is you need to specify eth1 static details;

auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0

Now you need to specify in the ppp section that the lease address that it picks up is the gateway for the system. I have not used this method as we use pppoa in the UK which is all handled by the modem/router interface but it should be easy enough to find out how to specify this. I am not sure what you are using eth1 for in this mix.

Last edited by TigerOC; 03-13-2007 at 08:04 AM.
 
Old 03-13-2007, 09:33 AM   #5
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 538

Original Poster
Rep: Reputation: 30
Hi TigerOC,

Sorry, I should have given more details about my setup.

It looks like this:

LAN -- eth1 -- Server -- eth0 (ppp0) -- ADSL modem -- Internet

So the server sits between our local network and the Internet (adsl modem) The ISP provides us a public IP address via DHCP. Eth0 is plugged into the modem and eth1 is plugged into our Lan switch.

I read the man page and have reconfigured my /etc/network/interfaces as follows:

Code:
auto lo eth1
iface lo inet loopback
iface eth1 inet static
      address 192.168.1.1
      netmask 255.255.255.0
      network 192.168.1.0
      broadcast 192.168.1.255

auto eth0
iface eth0 inet dhcp
When I rebooted my eth0 did not give itself an IP address which is what I wanted. I can access the Internet now through that box, if I first do echo "1" > /proc/sys/net/ipv4/ip_forward.

Is there any way I can get this to work at boot time:

Eth1 - comes up at boot
Eth0 - connects to ppp0/ADSL at boot time
ip_forward is set properly at boot time

I would like to have everythig work at start up - the less we have to type after booting up, the better.
 
Old 03-14-2007, 04:32 AM   #6
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
Make a small script;
Code:
 #!/bin/sh 
echo "1" > /proc/sys/net/ipv4/ip_forward
save the script in /etc/init.d as ip_forward.sh and then as root cd to /etc/init.d/ and do;
chmod 700 ip_forward.sh.

Test the script by doing /etc/init.d/ip_forward start which should execute without error. You can stop it by replacing start with stop. Now put it in the required run levels by doing as root (whilst still in /etc/init.d/);-

update-rc.d ip_forward defaults 89

if any stage you wish to remove these soft links to this script do;-

update-rc.d -f ip_forward remove

Last edited by TigerOC; 03-14-2007 at 04:40 AM.
 
Old 03-14-2007, 10:13 AM   #7
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 538

Original Poster
Rep: Reputation: 30
Hi TigerOC,

Thanks for your help, I think it worked! Without IP forward I can't do anything except via my squid proxy. I.E. no email, can't ping, etc.

I followed your direction and got this result:
Code:
root@proxy:/etc/init.d# update-rc.d ip_forward.sh defaults 89
 Adding system startup for /etc/init.d/ip_forward.sh ...
   /etc/rc0.d/K89ip_forward.sh -> ../init.d/ip_forward.sh
   /etc/rc1.d/K89ip_forward.sh -> ../init.d/ip_forward.sh
   /etc/rc6.d/K89ip_forward.sh -> ../init.d/ip_forward.sh
   /etc/rc2.d/S89ip_forward.sh -> ../init.d/ip_forward.sh
   /etc/rc3.d/S89ip_forward.sh -> ../init.d/ip_forward.sh
   /etc/rc4.d/S89ip_forward.sh -> ../init.d/ip_forward.sh
   /etc/rc5.d/S89ip_forward.sh -> ../init.d/ip_forward.sh
root@proxy:/etc/init.d#
Now: how do I get my ADSL to connect on boot? The command is: pon, do I just do the same thing as with setting ip_forward?

On my old Mandrake server, I had done the ip_forward setting in the init.d script, which I believe is similar to what we just did. But the ADSL, I believe, had its own script (which I no longer have access to since the Mandrake server died for good yesterday, and won't boot any more). Mandrake uses adsl-setup/adsl-connect and Debian/Ubuntu uses pon/poff for connections, so I couldn't just copy from the old server.

I realise you don't use ADSL but I have a feeling this is a simple problem ...
 
Old 03-15-2007, 03:35 AM   #8
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
Yes do the same thing;

Code:
#!/bin/sh
pon
Save it in /etc/init.d/ as adsl_connect.sh and then follow the same route as above.

So how does this system work? In the UK we use pppoa and we use modem/routers that are permanently connected and the router connects via ethernet to the lan box. So all this is handled by the router in the modem/router.
 
  


Reply


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
Setting Up a Content Filter with 2 network cards tubatodd Linux - Networking 1 05-13-2006 09:35 AM
Setting up wireless network cards in Slack 10?? Rhatlinux Slackware 2 10-21-2004 08:49 PM
Problems setting up my internet connection, DSL with two network cards ALInux Linux - Networking 8 08-23-2004 03:48 PM
Setting up Slackware 9.1 to use multiple network cards? Lynx2112 Slackware 7 06-10-2004 06:52 PM
setting up 2 network cards green_dragon37 Linux - Hardware 7 05-02-2003 12:52 PM


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