LinuxQuestions.org
Review your favorite Linux distribution.
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 05-26-2015, 11:25 AM   #1
ckamheng
Member
 
Registered: Apr 2003
Location: Malaysia
Distribution: Slackware 10.2
Posts: 75

Rep: Reputation: 15
net.inet.ip.forwarding=1


Hi,

I have two machines, one FreeBSD, another one RHEL6.5.
FreeBSD has public IP address and accessible to Internet.
RHEL6.5 has only private IP address and default gateway set to FreeBSD's private IP address.
Is there anyway to make RHEL6.5 accessible to Internet by forwarding network packet to FreeBSD?
On FreeBSD, net.inet.ip.forwarding has been set to 1.

Below are netstat -r output from FreeBSD and RHEL6.5
Note: xx.xx.xx.xx represent Public IP address

root@freebsd:/usr/home/fr # netstat -r
Routing tables

Internet:
Destination Gateway Flags Netif Expire
default <xx.xx.xx.161> UGS em0
<xx.xx.xx.160/27> link#1 U em0
<xx.xx.xx.184> link#1 UHS lo0
<xx.xx.xx.185> link#2 UHS lo0
localhost link#4 UH lo0
192.168.231.0 link#3 U em2
192.168.231.1 link#3 UHS lo0

[root@linux ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.231.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
default 192.168.231.1 0.0.0.0 UG 0 0 0 eth0

Below is Freebsd and RHEL6.5 FW running rules

root@freebsd03:/usr/home/fr # ipfw list
00100 allow ip from any to any via lo0
00101 allow ip from any to 127.0.0.0/8
00102 allow ip from 127.0.0.0/8 to any
00103 allow ip from any to any
65535 deny ip from any to any

[root@linux03 ~]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 state NEW,ESTABLISHED
6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 state NEW,ESTABLISHED
7 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
 
Old 05-26-2015, 12:15 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,162

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
This is not a Linux question. The forwarding would have to be done on the FreeBSD system.
 
Old 05-26-2015, 02:55 PM   #3
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
If it's a single port/service that you want to 'publish' that will be using the linux box, yuo could try using an ssh tunnel (remote if running ssh from linux, local if running ssh from FreeBSD) so that you could connect one port from the FreeBSD box to one port of the linux box. It doesn't involve any nat and could be easily set up.

http://www.revsys.com/writings/quick...sh-tunnel.html
 
  


Reply


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
Disabling IPv4 packet forwarding: net.ipv4.ip_forward = 0 (CentOS 5.5) troiwulful Red Hat 3 11-22-2010 11:04 AM
Packet forwarding for Battle.net port 4000 6112-6119 babbab Linux - Networking 9 04-02-2010 11:04 PM
inet<---eth1[LinuxBox_1]eth0<---e0[LinuxBox_2] : LinuxBox_2 hv no inet connection? Andrea_44 Linux - Networking 5 10-25-2006 08:18 PM
iptables port forwarding removes net access? Avatar Linux - Networking 2 05-21-2004 12:56 PM
No Inet cmull123 Linux - Networking 1 06-23-2003 02:55 PM

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

All times are GMT -5. The time now is 01:45 AM.

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