LinuxQuestions.org
Help answer threads with 0 replies.
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
  Search this Thread
Old 09-27-2010, 11:28 AM   #1
feci
LQ Newbie
 
Registered: Sep 2010
Posts: 2

Rep: Reputation: 0
Question I have two working ethernet interfaces, but I can't host services like SSH, HTTP, etc


Hello all,

I have a quite interesting problem which I can't sort out by myself. Hopefully some of you have the necessary knowledge to help me out.

I have two NIC's configured this way:

feci@GEP0:/$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:1c:c0:2e:2d:94
inet addr:192.168.0.198 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::21c:c0ff:fe2e:2d94/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:82565 errors:0 dropped:0 overruns:0 frame:0
TX packets:368242 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6459359 (6.4 MB) TX bytes:537036996 (537.0 MB)
Memory:e0500000-e0520000

eth1 Link encap:Ethernet HWaddr 00:40:f4:cf:84:d9
inet addr:192.168.2.108 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::240:f4ff:fecf:84d9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:328585 errors:0 dropped:0 overruns:0 frame:0
TX packets:273488 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:222918691 (222.9 MB) TX bytes:41672368 (41.6 MB)
Interrupt:18 Base address:0x1000

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:39845 errors:0 dropped:0 overruns:0 frame:0
TX packets:39845 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:40634426 (40.6 MB) TX bytes:40634426 (40.6 MB)

ppp0 Link encap:Point-to-Point Protocol
inet addr:79.114.41.24 P-t-P:10.0.0.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:314667 errors:0 dropped:0 overruns:0 frame:0
TX packets:267921 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:214503260 (214.5 MB) TX bytes:35101671 (35.1 MB)

eth0 is on my local network, connected to a router, configuration is set to DHCP (but practically I receive the same IP from the router, because of DHCP reservation).

eth1 is plugged into a cable modem and ppp0 works over this connection. eth1 is also set to DHCP, but it's IP can change from time to time.

For surfing the internet I normally use eth1, so the default gateway and nameserver configuration come from eth1.

For the second part I also have some services which I would like to expose to the internet, but only via the eth0 interface (through the router). Port forwarding (or Virtual Servers as they are called on my D-Link) are working correctly and I can say this because the services are accessible if eth1 is shut down.
However when both interfaces are up my services on eth0 are invisible from outside the router.

My theory about what is happening is the following, lets take SSH in this example:
If a connection is attempted on the ssh port my router will forward the packet to ssh on eth0 (this works because I can see the connection attempt in the ssh log in real-time), however I think that because eth1 is the default route ssh will respond on eth1 to the packet received on eth0. For this reason the router on the client or the firewall will reject response because there is no active connection between my machine's eth1 and the client (the connection is between my eth0 and the client).

The question is whether there is a solution for the problem?
Any help is appreciated.
Thanks
 
Old 09-27-2010, 11:36 AM   #2
Nemesiz
Member
 
Registered: Oct 2007
Posts: 44

Rep: Reputation: 2
ip r or netstat -r will be great. I think your problems is default gateway. Packet is coming to eth0 but the reply is send back by eth1. You must set route table.
 
Old 09-27-2010, 11:56 AM   #3
feci
LQ Newbie
 
Registered: Sep 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Hello Nemesiz,
thank you for the fast reply,


feci@GEP0:/$ ip r
10.0.0.1 dev ppp0 proto kernel scope link src 79.114.41.24
192.168.2.0/24 dev eth1 proto kernel scope link src 192.168.2.108
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.198
169.254.0.0/16 dev eth0 scope link metric 1000
default dev ppp0 scope link
default via 192.168.0.1 dev eth0 metric 100

feci@GEP0:/$ netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.0.0.1 * 255.255.255.255 UH 0 0 0 ppp0
192.168.2.0 * 255.255.255.0 U 0 0 0 eth1
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 0 0 0 eth0
default * 0.0.0.0 U 0 0 0 ppp0
default router 0.0.0.0 UG 0 0 0 eth0
 
Old 09-28-2010, 02:10 PM   #4
Nemesiz
Member
 
Registered: Oct 2007
Posts: 44

Rep: Reputation: 2
http://linux-ip.net/html/routing-tables.html

Can you do one trick? Open two consoles and enter:

Console1:
tcpdump -n -i eth0 host IP_ADDRESS

Console2:
tcpdump -n -i eth1 host IP_ADDRESS


IP_ADDRESS - external computer which will try to test your www or other service through router (eth0). You will see is the reply sends back through the same eth device.
 
  


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
SSH working via IP address, but not host? bluesword1969 Linux - Networking 6 02-03-2010 01:52 PM
mount NFS not working when both ethernet interfaces are up VGM Linux - General 5 01-05-2010 06:50 AM
Establishing a VPN connection (host to host) using IPSec services adithya24 Linux - Networking 9 06-10-2009 08:44 AM
Assigning services to interfaces seanro Slackware 2 03-16-2004 10:18 PM
Sample Working ipchain that allows http,ftp,ssh for internal and external network munisp Linux - Networking 1 11-09-2001 05:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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