LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-31-2012, 08:04 PM   #1
Jayzz
LQ Newbie
 
Registered: Dec 2012
Posts: 3

Rep: Reputation: Disabled
Port => Port Forwarding!


Hello, I have a server that is setup with the following

Server A: 1.2.3.4:9000

I have a second CentOS 5 server (Server B) that I would like to run this Server A though.

Example: 1.2.3.4:9000 (A) = > 5.6.7.8:9000 (B)

With 5.6.7.8:9000 showing the same data as 1.2.3.4:9000

This is not HTTP data and is TCP.
 
Old 12-31-2012, 08:20 PM   #2
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
Make it more clear your question. Are you looking a solution to run two servers with a application listening on port 9000? In that case you can use High-Availability or Load-Balancing solution.
 
Old 12-31-2012, 08:23 PM   #3
Jayzz
LQ Newbie
 
Registered: Dec 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kirukan View Post
Make it more clear your question. Are you looking a solution to run two servers with a application listening on port 9000? In that case you can use High-Availability or Load-Balancing solution.
Hello, I would like to proxy server A though server B

Thank you.
 
Old 12-31-2012, 08:33 PM   #4
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,657
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
Quote:
Port => Port Forwarding!
forward eth2 to network if. (sorry no ref.)
Code:
if [ -f /proc/sys/net/ipv4/ip_forward ]; then
    echo "Activating IPv4 packet forwarding."
    echo 1 > /proc/sys/net/ipv4/ip_forward
  fi

sudo iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
also,
see the file /etc/sysctl.conf and add this line,
Code:
#---------------------------------------------------------------
# Enable IP routing. Required if your firewall is protecting a
# network, NAT included
#---------------------------------------------------------------
net.ipv4.ip_forward = 1
Hope this helps, happy hollidays every one!
 
Old 12-31-2012, 08:39 PM   #5
Jayzz
LQ Newbie
 
Registered: Dec 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by GlennsPref View Post
forward eth2 to network if. (sorry no ref.)
Code:
if [ -f /proc/sys/net/ipv4/ip_forward ]; then
    echo "Activating IPv4 packet forwarding."
    echo 1 > /proc/sys/net/ipv4/ip_forward
  fi

sudo iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
also,
see the file /etc/sysctl.conf and add this line,
Code:
#---------------------------------------------------------------
# Enable IP routing. Required if your firewall is protecting a
# network, NAT included
#---------------------------------------------------------------
net.ipv4.ip_forward = 1
Hope this helps, happy hollidays every one!
Hello! Thank you for you're reply.
I get this error.
iptables: Unknown error 18446744073709551615
 
Old 01-01-2013, 09:46 PM   #6
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,657
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
Hi, I don't know what that error means.

Use the scripts to check.

Quote:
sudo iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
Make sure you change "eth2" to suit the external network.

($IPTABLES -A POSTROUTING -t nat -o $EXT_IF -j MASQUERADE)

eg. on my system it is eth0. where, eth0=ext_if and eth1=int_if

That's all I got.
 
  


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
Port number used by server when using dynamic port forwarding in SSH? kreeder Linux - Networking 4 11-21-2011 02:07 PM
Warning: remote port forwarding failed for listen port 7869 windstory Linux - Newbie 1 08-02-2010 10:07 AM
Shorewall: port forwarding problem, port is closed even after forwarding Synt4x_3rr0r Linux - Networking 2 12-13-2009 04:36 PM
port forwarding on Belkin 4-port Cable/DSL Gateway Router sycamorex Linux - Networking 5 03-05-2007 03:27 PM
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 07:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

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