LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 10-10-2009, 04:30 PM   #1
luckyluke09
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Rep: Reputation: 0
Question Listen same port on eth0 and eth0:1


Hi,

I need to use the same port on eth0 and eth0:1 but it seems it does not work.
Eth0 is allocated by an application which listens port 33000.
On eth0:1 I would need to run sshd, port 33000, but I get "error: Bind to port 33000".
Is it possible to share the same port with virtual ethernet?

For security reason I am able to use only port 33000.

Thank you.

Luke
 
Old 10-10-2009, 05:42 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You can use the same port on different interfaces regardless if they are real or virtual. In your case, I guess you bring up the virtual interface first, then you start your application, so it listens on both eth0 and eth0:1 on port 33000 and sshd cannot start.
What you should do is to first start you app, so it binds only on eth0, then bring up eth0:1 and start sshd using in sshd_config:
Code:
Port 33000
ListenAddress x.x.x.x
where x.x.x.x is the eth0:1 ip address.

Regards
 
Old 10-11-2009, 11:56 AM   #3
luckyluke09
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Question

Ok it works. I forgot my application was listening INADDR_ANY and had to set specific eth0 IP.

By the way, making a bit more complicate, I run in situation where there is a firewall between my server and client. The firewall has only one port forwarding to my eth0 and nothing to virtual eth.
In such situation I need to have 2 sockets in listening, my application and sshd, but I have all traffic coming on eth0.
From client pc I need to connect to my server application and also time by time connect to sshd. On the firewall I can only have 1 port forwarding.
Is it possible to have a mechanism on my server to listen 33000 on eth0 and re-route the ssh traffic to eth0:1 and the rest to my application on eth0?

Thx.
Luke
 
Old 10-11-2009, 05:24 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Is it possible to have a mechanism on my server to listen 33000 on eth0 and re-route the ssh traffic to eth0:1 and the rest to my application on eth0?
The only application that comes in my mind and can do what you want, is a portal server running some custom made java applets, that allow a remote user to access resources on the server using the portal's web interface.
 
  


Reply



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 tunnel only listening on loopback device. Should also listen on eth0 paranoid times Linux - Networking 3 02-10-2009 02:20 PM
named does not listen on eth0 right after boot. algogeek Linux - Server 4 09-04-2008 02:08 PM
Eth0 using DHCP and eth1 using static ip: eth0 receive internal ip not the router ip geraldomanaus Linux - Networking 3 04-23-2008 03:00 PM
Wireless network on eth1 diabled Ethernet eth0 and eth0 never comes back tadatoshi Linux - Wireless Networking 4 09-23-2004 05:57 PM
Firewall WAN eth0 LAN eth1 self-bridges, eth0 does all routeing. Nichole_knc Linux - Networking 5 07-29-2004 02:33 PM

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

All times are GMT -5. The time now is 11:28 PM.

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
Open Source Consulting | Domain Registration