Go Back   The UNIX and Linux Forums > Special Forums > IP Networking


IP Networking Learn TCP/IP, Internet Protocol, Routing, Routers, Network protocols in this UNIX and Linux forum.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-28-2012
Registered User
 
Join Date: Apr 2012
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Problem in eth0 and eth1 sharing internet with other computers

hellow everbody.
iam using 32 bit centos 6.2 on my desktop and iam new to linux. i have eth0 and eth1 on my desktop. so i have some problems i have menson here:

i have edited:

Code:
etc/sysctl.conf
net.ipv4.ip_forward = 1

and i have edited iptables too


Code:
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# iptables --append FORWARD --in-interface eth1 -j ACCEPT
# iptables-save


this is my configuration of my desktop:

for eth0

Code:
address            netmask        gateway
10.10.10.101   255.0.0.0       10.10.10.254

dns servers 10.10.10.254

10.10.10.254 is my wireless router given from my isp.

for eth1

Code:
address          netmask            gateway
192.168.1.1   255.255.255.0   10.10.10.101

dns servers 10.10.10.101


i have windows xp installed in my laptop:

local area network:

Code:
address          netmask              gateway
192.168.1.2   255.255.255.0   192.168.1.1

dns servers 192.168.1.1

when i enable eth0 and eth1:

Code:
eth0      Link encap:Ethernet  HWaddr 00:E2:1C:D1:42:A3  
          inet addr:10.10.10.101  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::2e2:1cff:fed1:42a3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3058 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3222 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2719502 (2.5 MiB)  TX bytes:430301 (420.2 KiB)
          Interrupt:21 Base address:0xe000 

eth1      Link encap:Ethernet  HWaddr 00:C0:26:75:B2:D7  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::2c0:26ff:fe75:b2d7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11 errors:0 dropped:0 overruns:0 frame:0
          TX packets:80 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:676 (676.0 b)  TX bytes:11555 (11.2 KiB)
          Interrupt:22 Base address:0xa000



problem from my desktop (10.10.10.101) enabling eth0 and eth1

when i ping yahoo.com from my desktop (10.10.10.101)

Code:
PING yahoo.com (209.191.122.70) 56(84) bytes of data.
From 192.168.1.1 icmp_seq=1 Destination Host Unreachable
From 192.168.1.1 icmp_seq=3 Destination Host Unreachable
From 192.168.1.1 icmp_seq=4 Destination Host Unreachable
From 192.168.1.1 icmp_seq=6 Destination Host Unreachable
From 192.168.1.1 icmp_seq=7 Destination Host Unreachable

i was not able to get reply

when i ping 10.10.10.254. 10.10.10.254 is my wireless router given from my isp.

Code:
$ ping 10.10.10.254
PING 10.10.10.254 (10.10.10.254) 56(84) bytes of data.
64 bytes from 10.10.10.254: icmp_seq=1 ttl=64 time=0.311 ms
64 bytes from 10.10.10.254: icmp_seq=2 ttl=64 time=0.279 ms
64 bytes from 10.10.10.254: icmp_seq=3 ttl=64 time=0.285 ms
64 bytes from 10.10.10.254: icmp_seq=4 ttl=64 time=0.309 ms

i get reply


problem from my laptop or 192.168.1.2

Code:
1 ) while ping 192.168.1.1 (eth1 on desktop) from 192.168.1.2 (from laptop) i get reply.
2 ) i was not able to browse internet form my 192.168.1.2 (laptop)
3 ) but when i disable eth1, i was able to browse internet on my desktop but no connection between eth1 (desktop) and my laptop

while disabling eth1:

Code:
eth0      Link encap:Ethernet  HWaddr 00:E2:1C:D1:42:A3  
          inet addr:10.10.10.101  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::2e2:1cff:fed1:42a3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2721 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2817 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2285759 (2.1 MiB)  TX bytes:381862 (372.9 KiB)
          Interrupt:21 

eth1      Link encap:Ethernet  HWaddr 00:C0:26:75:B2:D7  
          inet6 addr: fe80::2c0:26ff:fe75:b2d7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1005 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1025 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:72323 (70.6 KiB)  TX bytes:85135 (83.1 KiB)
          Interrupt:22 Base address:0xc000

ping yahoo.com from my desktop (10.10.10.101)

Code:
PING yahoo.com (98.139.183.24) 56(84) bytes of data.
64 bytes from ir2.fp.vip.bf1.yahoo.com (98.139.183.24): icmp_seq=1 ttl=49 time=412 ms
64 bytes from ir2.fp.vip.bf1.yahoo.com (98.139.183.24): icmp_seq=2 ttl=49 time=405 ms
64 bytes from ir2.fp.vip.bf1.yahoo.com (98.139.183.24): icmp_seq=3 ttl=49 time=396 ms
64 bytes from ir2.fp.vip.bf1.yahoo.com (98.139.183.24): icmp_seq=4 ttl=49 time=421 m

iam so confused. what i need is i want to enable eth0 and eth1 and can browse internet from my desktop and can share internet to other laptop through switch.

any kinds of ideas, suggestions and guidelines are welcome and i'll greatful if u let me clear my problem.
THANK YOU IN ADVANCE.
Sponsored Links
    #2  
Old 05-29-2012
Registered User
 
Join Date: Mar 2008
Location: Italy - EU
Posts: 172
Thanks: 5
Thanked 35 Times in 35 Posts
Hi,

did you reboot after editing /etc/sysctl.conf.

Alternatively you could try:

Code:
cat /proc/sys/net/ipv4/ip_forward echo "1"

(no need to reboot for changes taking effect).

You could also stop iptables during troubleshooting (so you don't have to worry about firewall misconfiguration).

Also, please share the output of:

Code:
route -vn

(make sure the default gateway is 10.10.10.254).

see ya
fra
Sponsored Links
    #3  
Old 05-29-2012
fpmurphy's Avatar
who?
 
Join Date: Dec 2003
Location: /dev/ph
Posts: 4,434
Thanks: 47
Thanked 358 Times in 332 Posts
Quote:
Originally Posted by frappa View Post
Hi,
Alternatively you could try:

Code:
cat /proc/sys/net/ipv4/ip_forward echo "1"

That should probably read

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

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Ubunut iptable not routing trafic between eth1 and eth0 florin.bv Ubuntu 2 05-11-2012 09:33 AM
Reg- eth0,eth1 (ethernet card) kurva Solaris 1 07-09-2009 06:02 PM
controlling traffic source from NIC eth0, eth1 in Linux mdap UNIX for Dummies Questions & Answers 0 05-01-2009 08:22 PM
ifcfg-eth0 and eth1 is N/A kenshinhimura Red Hat 2 03-12-2008 06:14 PM



All times are GMT -4. The time now is 01:10 PM.