LinuxQuestions.org
Visit Jeremy's Blog.
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 12-16-2004, 01:09 PM   #1
falconkid
LQ Newbie
 
Registered: Dec 2004
Location: Chile
Distribution: red hat
Posts: 11

Rep: Reputation: 0
Angry TCP/IP configuration issues


Hope you don't kick me out of the forum for asking this.

I'm running redhat 9 on an intel P4, everything worked fine, I managed to connect it to a dsl connection, it works fantastic, then I added a second lan card, I actually understand the problem. But all the solutions I have seen in the formums are for text mode (I just never even seen it), I installed in graphics mode, and just once have used the "terminal", and I could use a hand on how to configure my lan cards just to share internet connection. This might sound dumb, but I tried with:

IP 192.168.10.2 (card 1)
Netmask 255.255.255.0

No dns

IP 192.168.10.3 (card 2)
Netmask 255.255.255.0
Gateway 192.168.10.1

When I do this the dsl quits.

As a note, I'm not dumb, I just don't know what I'm doing.

 
Old 12-16-2004, 01:30 PM   #2
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 524

Rep: Reputation: 30
" I actually understand the problem"

So... exactly what is the problem? Ever since you installed the second card, dsl doesn't work? or you just can't share the connection?

Here are some command line to help you figure out what's going on where $ is your command prompt (have to be root for some of these)

$ adsl-status
$ adsl-stop
$ adsl-start
$ ifconfig (this will show the configureations of the cards)
$ ifconfig eth0 [or eth1]

To share the Internet connection with another workstation you need to do the following things.

1. One of the cards should be configured by you (i.e. 192.168.....) and the other should be DHCP (because the IP will be assigned by the ADSL provider) ... your connection will be ppp0, not eth1 or eth0
2. Set up the other computer to use the internal card as a gateway
3. If you have iptables (firewall) set up in redHat, you MUST enable IP forwarding or else the connection will not work between cards.

HTH

--A
 
Old 12-16-2004, 01:32 PM   #3
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 524

Rep: Reputation: 30
Here's a little diagram of how mine is set up.


Internet -- ppp0 - eth0 (DHCP) --LINUX SERVER-- eth1 (192.168.1.1) -- LAN (windows)
 
Old 12-16-2004, 01:47 PM   #4
falconkid
LQ Newbie
 
Registered: Dec 2004
Location: Chile
Distribution: red hat
Posts: 11

Original Poster
Rep: Reputation: 0
Sorry, I did not specify:

I have eth0 on automatic so the ip comes from service provider, then what I did was give IP's to both eth0 and eth1, it seems I'm dumber than I thought.

My connection is pp0, so when Linux boots it starts eth0 - eth1, and then ppp0 with OK.

so then since my dsl connection goes through eth0, I should just configure eht1.

Thanks, i'll try this and keep you posted.
 
Old 12-16-2004, 03:39 PM   #5
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 524

Rep: Reputation: 30
You should only give a static IP to eth1, yes, because technically eth0 should be "down" until it has the Internet connection ... but you need to configure IP forwarding also, so that traffic can flow between the two interfaces.

type the following on a command line

$ cat /proc/sys/net/ipv4/ip_forward
If the system returns "0" then you will not be able to pass packets between the cards. to set: $ echo 1 > /proc/sys/net/ipv4/ip_forward

In addition your iptables must also be configured to forward the packets from one interface to another.

HTH
 
Old 12-16-2004, 11:41 PM   #6
falconkid
LQ Newbie
 
Registered: Dec 2004
Location: Chile
Distribution: red hat
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks a lot, I'll try to configure the ipforward thing, it was bugging my head that I should tell eth1 where to look for the connection, and I couldn't give it a gateway that I didn't know which it was going to be.

I'll use the commands and keep you posted, I'll give it a try after work tomorrow.

I'm sure it will work.

thanks again
 
Old 12-17-2004, 10:46 AM   #7
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 875

Rep: Reputation: 179Reputation: 179
The other reason it didn't work, and won't work is that you have put both eth's into the same subnet. A router, by definition, isn't a router unless it has interfaces in more than one subnet. Try 192.168.10.2 and 192.168.11.2, you might get somewhere.
 
Old 12-17-2004, 11:45 AM   #8
falconkid
LQ Newbie
 
Registered: Dec 2004
Location: Chile
Distribution: red hat
Posts: 11

Original Poster
Rep: Reputation: 0
OK now I'm confused, let me get this straight.

eth0 is auto, because the ppp0 connection is the one that gives it the IP and all the info.

eht 1 is configured with information I feed it.

ok then which is my gateway ?

I assume the IP given by the dsl will be somewhere in the 192.168.1.x

Then according to baldy I will need for eth1 192.168.2.x

but when I give an IP to eth0 the dsl does not work, so it seems that the only card that can be configured is eth1.

the issue now is what exactly with ?:

IP: 192.168.10.1 (let's say)
Netmask: 255.255.255.0 Or other ?
Gateway: Who knows ?

DNS 1 The dns should be the DNS of my service provider ? I guess so..
DNS 2

I still have not tried avatar's solution, i'm still at work and heve not gone home, so I guess i will try things in order of appearance, and stick to the one tat wirks first.

BTW I still have no firewall or iptables, I wanted to connect the thing properly and then set up the firewall, Hope i didn't make things worse.

Thanks to all
 
Old 12-18-2004, 09:26 AM   #9
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 875

Rep: Reputation: 179Reputation: 179
The reason it probably failed is that when you give an ip address to an interface a route is put in the route table for that directly connected network. If you add a second interface into the same network the box now has to choose which interface it will point the route at and will choose one, more than likely the one with the higher ip address.

Now if your default route has a next hop of 192.168.1.1 via eth0 but you have told your box that 192.168.1.0 is also on eth1 when a packet need to be routed the box will try to forward the packet to the next hop via the wrong interface. What ever the address is that your ISP gives you DON'T configure the same network on eth1 or everything will go tits-up.

p.s. I would be surprised if your ISP gives you a 192.168.1.x address as the 192.168.0.0 range is reserved for internal use only and does not exist on the internet.

p.p.s due to this fact, if you want to use eth1 as a gateway to the internet for other devices on your network you will also need to configure nat.
 
Old 12-20-2004, 11:29 AM   #10
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 524

Rep: Reputation: 30
Baldy is correct but you won't need to assign any subnet to eth0 if that is your ADSL connection.

Here's what mine is.

LAN clients are set up to use my Server as a gateway 192.168.1.1

so it goes like this

LAN - 192.168.1.1 eth1 - Linux router - eth0 (ppp0 connection) (ISP assigned address) XX.XX.106.22 - Internet

(continued below... sorry)
 
Old 12-20-2004, 11:56 AM   #11
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 524

Rep: Reputation: 30
So basically the cards ARE on different subnets since one is an internal IP and the other is an External IP.

On boot I initialise eth1 with the internal IP address; (set the onboot=yes) 192.168.1.1 and the other I do not initialise at boot time (onboot=no) but I start the ADSL. Basically you totally ignore the eth0 card and use ppp0 as the connection.

He's right about NAT - you configure this along with IP forwarding in iptables. and enable IP forwarding as I have indicated.

I know this sounds complicated to understand, but it's really fairly straighforward: you are routing the LAN to the Internet via your Internal LAN card forwarded to your External Internet card.

Baldy was saying that in your current config you were routing FROM your LAN TO your LAN, that's why it wasn't working.

Set up forwarding and you're good to go. If you need help with how to do that just post back here, and I can show what I have, but there is ample information on Google or even on these forums.

Let us know.
 
Old 12-20-2004, 01:01 PM   #12
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 524

Rep: Reputation: 30
I think it will also help you if I answer your questions directly.

Quote:
Originally posted by falconkid
OK now I'm confused, let me get this straight.

eth0 is auto, because the ppp0 connection is the one that gives it the IP and all the info.

eht 1 is configured with information I feed it.
Yes, exactly

Quote:

ok then which is my gateway ?

I assume the IP given by the dsl will be somewhere in the 192.168.1.x

Then according to baldy I will need for eth1 192.168.2.x
The gateway for your LAN clients will be the INTERNAL address (the address you made up) of your server. On your server itself for the internal card, i forget if it needs a gateway, I will have to double check on mine).

You are not correct, The IP given by your ADSL provider will be a public address and it could be anything but not in the 192.168.X.X or the 10.X.X.X range. It could be for example, 64.122.94.32. So as long as you assign eth1 anything in the 192.168 range, you will not have to worry about any conflicts. 192.168.10.1 is fine. Just make sure your clients are using the same subnet. (i.e. 192.168.10.X)

Quote:
but when I give an IP to eth0 the dsl does not work, so it seems that the only card that can be configured is eth1.
Correct. eth0 is assigned by your DSL provider's DHCP server. Do not configure it yourself.

Quote:

the issue now is what exactly with ?:

IP: 192.168.10.1 (let's say)
Netmask: 255.255.255.0 Or other ?
Gateway: Who knows ?

DNS 1 The dns should be the DNS of my service provider ? I guess so..
DNS 2
IP address and netmask are fine. I am not sure about the gateway but I would use 192.168.10.1 for now to see if that works. (my server is down right now but I will check if that doesn't work).
DNS1 and 2 settings will be that of your service provider unless you are running your own DNS server on the machine, then you can put 127.0.0.1 here. Normally, the DNS settings are stored in /etc/resolv.conf

We'll get that machine purring happily, don't worry.
 
Old 12-20-2004, 03:17 PM   #13
falconkid
LQ Newbie
 
Registered: Dec 2004
Location: Chile
Distribution: red hat
Posts: 11

Original Poster
Rep: Reputation: 0
Thumbs up

Thanks a lot, I couldn't try this on the weekend, but I'll try it tonight and let you know...
 
Old 12-20-2004, 10:05 PM   #14
falconkid
LQ Newbie
 
Registered: Dec 2004
Location: Chile
Distribution: red hat
Posts: 11

Original Poster
Rep: Reputation: 0
OK, bad news, I configuerd my eth1 as:

I.P: 192.168.10.1
subnet mask: 255.255.255.0
gateway 192.168.10.1

eth 0 I left on auto to get config from my dsl provider.

I am now using Linux to post here, as long as I keep eth1 deactivated internet works, if i activate eth1 my internet quits.

I have a friend that has a server configured just as i need, so is there a way to "see" the eth 0 and eth1 in text mode settings witout aletring them ?

I could copy his settings, but I can't change anything, cause if i mess up things he will be charged for the fixing.

I don't get it, this sounded reasonable, but it didn't work


Well, if you have any ideas let me know.

BTW I executed the: $ echo 1 > /proc/sys/net/ipv4/ip_forward

but I never found out if it did what it was supposed to do, I did not have any internet working with eth1 activated, it somehow messed up ppp0 or eth0, well who knows.


thanks.
 
Old 12-21-2004, 01:15 AM   #15
falconkid
LQ Newbie
 
Registered: Dec 2004
Location: Chile
Distribution: red hat
Posts: 11

Original Poster
Rep: Reputation: 0
OK, sorry, but I did it with windows, I'll keep on learning about Linux, but I needed the shared internet connection.
I've seen this is a recurrent issue with Linux all over the web, truckloads of people wanting to use it as what it's meant to be, a server, until it gets simpler, us mortals will have to keep reliying on bill gates.
As soon as I can afford an extra computer for experimentation, I'll give it another try, for now, windows will have to do.
Sorry for having bothered, but I really like Linux. I guess I was not up to it.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Netstat issues 'warning, got duplicate tcp line' English_Man Linux - Networking 5 04-13-2009 03:07 AM
Printers configuration on TCP/Ip port xpucto Linux - Newbie 2 09-27-2005 10:25 AM
How to see TCP/IP configuration of a Linux PC eflester Linux - Networking 10 10-27-2004 12:18 AM
Woody 3.0 Open Ports 1470/tcp/uaiact 1518/tcp/vpvd What for?How can I remove them? alexxxis Debian 5 07-05-2004 05:18 PM
Debian Help! Tcp/ip Configuration... acidbreez Linux - Networking 1 08-11-2003 01:58 AM


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