LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Port => Port Forwarding! (https://www.linuxquestions.org/questions/linux-security-4/port-%3D-port-forwarding-4175443642/)

Jayzz 12-31-2012 08:04 PM

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.

kirukan 12-31-2012 08:20 PM

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.

Jayzz 12-31-2012 08:23 PM

Quote:

Originally Posted by kirukan (Post 4860385)
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.

GlennsPref 12-31-2012 08:33 PM

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!

Jayzz 12-31-2012 08:39 PM

Quote:

Originally Posted by GlennsPref (Post 4860388)
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

GlennsPref 01-01-2013 09:46 PM

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.


All times are GMT -5. The time now is 12:00 AM.