LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   I think this is an "ip forwarding" problem... (https://www.linuxquestions.org/questions/linux-networking-3/i-think-this-is-an-ip-forwarding-problem-293349/)

perdesiz 02-22-2005 07:13 AM

I think this is an "ip forwarding" problem...
 
I do have a desktop PC in my office and it is connected to LAN via ethernet(say eth0). What I do wanna do is connecting another ethernet card(say eth1) to that desktop PC and connect my laptop to network over that PC.
When I connected second ethernet card my connection has gone somehow.

when I run "lspci" command I can see both of my ethernet cards and when I run "ifconfig" I see that there is no change on my network adjustments for eth0 but my connection is somehow gone. I tested it simply by running "ping" command.

Furthermore I tried to add net by "route" command for "dev eth1" by
"route add -net 192.168.99.0 netmask 255.255.255.0 dev eth1"

but It gives an error as "SIOCADDRT: No such device"

what should I do ? Any Ideas?

visiondream3 02-22-2005 07:20 AM

Hi,
I have faced the exact error when I didnt have enough permissions. ie when I was not the root user.

perdesiz 02-22-2005 07:27 AM

I ve been "root"

that is not the problem.
May be it is OS specific.
I am using slackware 10.0

visiondream3 02-22-2005 07:45 AM

You're sure forwarding is enabled ?

net.ipv4.ip_forward = 1 in /etc/sysctl.conf ?

perdesiz 02-22-2005 07:50 AM

there is no file called sysctl.conf under /etc directory actually

visiondream3 02-22-2005 07:54 AM

what abt this one :

/proc/sys/net/ipv4/ip_forward

do you have that ?

what kernel are u running ?

perdesiz 02-22-2005 07:58 AM

the kernel is 2.4.26
the parameter you say is 1 in my system

visiondream3 02-22-2005 08:18 AM

I have a lan setup here, and this is all I had to do :

made sure /proc/sys/net/ipv4/ip_forward is 1.

enabled IP masquerading :

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

iptables -A FORWARD -s your_lan_ip_range -j ACCEPT
iptables -A FORWARD -d your_lan_ip_range -j ACCEPT

now all packets coming to eth0 gets forwarded.

now set the route.

perdesiz 02-22-2005 08:42 AM

I have performed what you said.

No change...

Here is my problem first of all;

I have a working LAN connection via ethernet. But when I connect a second ethernet card the connection goes off...

First of all I have to enable my network connection with 2 ethernet cards installed. This must be the first step .What you think?

visiondream3 02-22-2005 10:04 AM

Hi,
You can bring up both ethernet cards separately.

ifconfig eth0 192.168.1.1 up
ifconfig eth1 192.168.1.2 up

You can now start using them.

sorry, correct it as given above :

Quote:

Hi,
You can bring up both ethernet cards separately.

ifconfig eth0 192.168.1.1 up
ifconfig eth0 192.168.1.2 up

You can now start using them.

perdesiz 02-22-2005 10:45 AM

hi,

first of all thanx for your interest.

Now my LAN ip for eth1 is something like 193. .... .101

now when I just make "ifconfig eth1 192.168.1.1 up" my connection goes off...
I tried giving the same ip to eth1 (namely the one starting with 193. ... )as well, then I could connect to intranet but not internet.

I guess this problem is caused by the fact that I use two ethernet cards with the same chipset...

What you think?

visiondream3 02-22-2005 10:51 AM

Hello,
if your card is already up. You have to bring it down before trying to bring it up.

Do,

ifconfig eth1 present_ip down
ifconfig eth1 new_ip up

should do the job :)

( Make sure you are local and not connected through eth1 and networked, or you'll get kicked out when you bring the interface down )

perdesiz 02-22-2005 11:00 AM

I wrote something wrong as a result you misunderstood, sorry for that...
Now my LAN ip for eth0 (not 1) is something like 193. .... .101 (this ip is the one I sholu have for my connection to LAN)

now when I just make "ifconfig eth1 192.168.1.1 up" my connection (the one related to eth0 ) goes off...

What I wanna do is that giving 192.168.1.1 to the eth1 on my desktop pc and giving my laptop 192.168.1.2 and then connecting to internet via my desktop pc. ...

I guess this problem is caused by the fact that I use two ethernet cards with the same chipset...


Now what you think?? :)

visiondream3 02-22-2005 11:40 AM

If you are connecting the internet ip on the eth0, it should not be a LAN ip.
If you are on a dhcp ( dsl connection) then the ethernet end provided by your ISP will bring up whatever ip your eth0 needs to have.
You just need to bring up a local ip on the eth1 then. After this you can setup the forwarding on eth1 as we discussed earlier.

If you have a problem identifying eth0 and eth1, please get a pic of your desktop pc's (backside of the cabinet.) and your connection.
We should be able to figure something out ;)

Also, may be you should try the network setup command specific to slackware.

redhat has this command called 'setup' that helps you to configure network configuration.

Baco 02-22-2005 11:48 AM

I would say that you have to fix that conflit problem between those 2 ethernet cards...
They should BOTH be working just fine with 2 diferent IP's.

I have a machine doing exactly what u want to do....
this is the output from the ifconfig


[root@cm-84-90-1X-XX root]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:FC:5A:3D:CA
inet addr:84.90.1X.XX Bcast:84.90.19.255 Mask:255.255.252.0
inet6 addr: fe80::250:fcff:fe5a:3dca/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:646256 errors:0 dropped:0 overruns:0 frame:0
TX packets:736128 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:453562341 (432.5 Mb) TX bytes:198945329 (189.7 Mb)
Interrupt:11 Base address:0x5000

eth1 Link encap:Ethernet HWaddr 00:0A:CD:04:42:48
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20a:cdff:fe04:4248/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:741732 errors:0 dropped:0 overruns:0 frame:0
TX packets:646326 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:199627796 (190.3 Mb) TX bytes:453672379 (432.6 Mb)
Interrupt:9 Base address:0xc000

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:821 errors:0 dropped:0 overruns:0 frame:0
TX packets:821 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:108466 (105.9 Kb) TX bytes:108466 (105.9 Kb)

To do this I have made a script to configure IPTABLES, I can post it if u want tho u need to have those 2 cards up before u can do anything.


All times are GMT -5. The time now is 07:27 AM.