Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 04-12-2009, 07:15 AM   #1
LQ Newbie
Registered: Dec 2004
Posts: 4

Rep: Reputation: 0
separate services on different network interfaces


I've got 2 NIC's that both have Internet connectivity as follows:
- eth0, public static IP (80.x.x.Y)
- eth1, private static IP (192.168.0.x goes through router: router also has a public static IP (80.x.x.Z)

Default route is set through eth0, however I'm trying to set up different services to be available on eth1 as well (or exclusively) - example: ftp server, ssh daemon.

So I connected eth1, assigned a private IP address ( with a default gateway (/25), set sshd to listen to all interfaces ( for testing), set port forwarding on router so that ssh connections on 80.x.x.Z would be sent to and got time out when trying to ssh 80.x.x.Z. I also tried ssh to which worked.

I guess I'm missing a step here hopefully (as I hope it's not the cheap router's fault). Could anyone provide a tip ?
Old 04-12-2009, 01:51 PM   #2
Registered: Aug 2003
Location: Seattle
Distribution: ubuntu, lately
Posts: 182
Blog Entries: 1

Rep: Reputation: 35
Incoming packets hit eth1 but are routed back through eth0, which will prevent the connection from going forward. This isn't a linux configuration issue, rather one of network basics. Basically your inbound paths and outbound paths are not the same, which is a problem when using private IP space and NAT.

Your goals with such a setup are not clear; there are likely better ways to accomplish what you need to do. But if your current setup is necessary, then i see two ways you can get it to work:

1) In addition to port-forwarding the incoming connections on the router, also NAT the connection's source address (at the router) to the 192.168.0.x space (SNAT in iptables nomenclature). Connections received on eth1 will be seen coming from 192.168.0.x and pkts will be returned to the router, which will handle all of the NAT. Most consumer-based broadband routers won't let you do this, but if you have a linux router and are using iptables this should be pretty straight forward.

2) Use policy routing using 'ip rule' and 'ip ro table' configurations. These are advanced networking features so if you aren't familiar with them you will need to spend some time learning about them.

If those options don't work for you, you should re-think your network design (best option in my opinion)
Old 04-13-2009, 04:02 PM   #3
LQ Newbie
Registered: Dec 2004
Posts: 4

Original Poster
Rep: Reputation: 0
Thank you for your reply, grepmasterd

Regarding the network setup, actually, I have no specific restrictions: It just happened that eth1 is routed to the internet through a home router (being part of a LAN) so I decided to test it without changing anything; however I can plug in eth1 directly to the internet via the public IP currently used by the router.

As for the goal I'm aiming at, it is to have certain services available on a free interface (eth1). Given that eth0 sometimes gets overloaded by bandwidth consuming services, I'm looking at placing administration services (eg. ssh) on a different interface with more bandwidth availability.

I read some introductions about load balancing, but I wanted to start up with something simple first.

I wonder why was it that when ssh-ing in on from the local machine, the login prompt would show up (meaning that packets were not being routed back out on eth0) - Are local addresses translated to on lo interface ?


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
the network scripts to create network interfaces for 802.1q VLANs 10 and 11, Lahore Linux - Networking 0 03-18-2009 05:45 AM
Configuring Multiple Interfaces with Separate Parameters fossks Linux - Networking 1 07-26-2008 06:18 PM
For laptop - different networks in /etc/network/interfaces, or use network-manager? dmravaet Linux - Wireless Networking 4 03-17-2007 11:42 PM
Manual Network Setup Works, /etc/network/interfaces doesn't verdeboy2k Linux - Wireless Networking 0 05-31-2006 06:56 PM
Assigning services to interfaces seanro Slackware 2 03-16-2004 10:18 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:46 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration