LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-15-2014, 04:18 AM   #1
rcmonroig
Member
 
Registered: Mar 2007
Location: Chandler, AZ
Distribution: Fedora 10,12,and 14
Posts: 62
Blog Entries: 1

Rep: Reputation: 15
Unhappy How do I configuring Linux as a router


I am trying to configure a Linux router

I am running Centos 6.5 on an i5 quadcore server with 32G of RAM and 80G hard drive

I have 2 NICs eth0 and eth1

eth0 is connected to the internal LAN with a static IP 192.168.0.1/24 with port forwarding turned on.

and eth1 is connected to our public switch with a static IP 140.x.x.127.

I have an internal VMware cloud at 192.168.0.101:9443
I configured the firewall through the GUI. I turned on ports 21 for ssh, 80 for http, 8080 for webcache and 443 for https.

I have masquerading turned on for eth1.

and packet forwarding turned on from eth0 192.168.0.1 to eth1 140.x.x.127

My question is:
how do I configure eth1 140.x.x.127 to redirect packets coming in on 8080 to 192.168.0.101:9443 in the firewall GUI?

Any help would be greatly appreciated.

Thanks,
RonM
 
Old 10-15-2014, 06:13 AM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
I turned on ports 21 for ssh, 80 for http, 8080 for webcache and 443 for https.
ssh is 22

Show "cat /proc/sys/net/ipv4/ip_forward".
Show your "iptables-save" output (with IPs redacted 140.x.x.12 if you wish).
 
Old 10-15-2014, 11:56 AM   #3
rcmonroig
Member
 
Registered: Mar 2007
Location: Chandler, AZ
Distribution: Fedora 10,12,and 14
Posts: 62

Original Poster
Blog Entries: 1

Rep: Reputation: 15
how to I configure linux router

Thanks for your quick response. I'm attaching a copy of the iptables and result of ip_forward setting. I appreciate you looking at this.

RonM
Attached Files
File Type: txt iptables-1015.txt (1.7 KB, 18 views)
File Type: txt ipforwardisset.txt (2 Bytes, 11 views)
 
Old 10-15-2014, 05:32 PM   #4
rcmonroig
Member
 
Registered: Mar 2007
Location: Chandler, AZ
Distribution: Fedora 10,12,and 14
Posts: 62

Original Poster
Blog Entries: 1

Rep: Reputation: 15
How to configure a Linux router

Please refer to the attachment for a diagram of the router question.
Attached Files
File Type: pdf linux_router_diagram.pdf (96.3 KB, 27 views)
 
Old 10-15-2014, 08:10 PM   #5
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
Do these sort you out?

http://blog.softlayer.com/2011/iptab...rt-redirection

http://linux-ip.net/html/nat-dnat.html
 
Old 10-15-2014, 08:57 PM   #6
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
well i guess a route is need to be set here to achieve you want..
see 'route' man page for more.
Code:
route add -host x.x.x.x gw x.x.x.x eth0 (something like this)
 
Old 10-16-2014, 06:34 PM   #7
rcmonroig
Member
 
Registered: Mar 2007
Location: Chandler, AZ
Distribution: Fedora 10,12,and 14
Posts: 62

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Cool thanks linosaurusroot

I will check it out and back to you. Thanks again.
 
Old 10-17-2014, 11:11 AM   #8
Parbold
LQ Newbie
 
Registered: Oct 2014
Location: West Midlands
Distribution: Centos, AmazonLinux, RedHat, Oracle Linux
Posts: 4

Rep: Reputation: Disabled
Quote:
How do I configure eth1 140.x.x.127 to redirect packets coming in on 8080 to 192.168.0.101:9443 in the firewall GUI?
I did something similar using iptables:-

I am not an iptables expert but I think the config commands you would require are:-

Code:
# Allow portforwarding of 8080 traffic to 192.168.0.101:9443
iptables -A PREROUTING -t nat -i eth1 -p tcp --dport 8080 -j DNAT --to 192.168.0.101:9443
iptables -A FORWARD -p tcp -d 192.168.0.101 --dport 9443 -j ACCEPT
service iptables save
The you would connect to the local IP address on eth1 on port 8080, but the traffic would be sent to 192.168.0.101 port 9443
 
  


Reply

Tags
routers, routing


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
Configuring linux router with four networks Gil@LQ Linux - Networking 4 07-24-2012 03:52 AM
Need help with configuring my Linux-server / router bytebuster Linux - Networking 2 08-31-2009 04:39 PM
Configuring Linux Router SBN Linux - Networking 8 02-16-2007 08:27 PM
Configuring Linux As Router davysouthernboy Linux - Networking 3 05-19-2006 01:06 AM
I need help configuring Linux behind router ?? neilmon2 Linux - General 7 10-16-2002 04:26 PM

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

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