I'm trying to set up a GRE tunnel between a FreeBSD server and a CentOS server. I want the FreeBSD server to be the one with the hidden IP. I'm having trouble making the connections I need. Only port 80 seems to work. I have PF disabled, and no firewall running on CentOS. I will be using placeholders for the IP addresses.
x.x.x.x will be FreeBSD's IP
y.y.y.y will be CentOS's IP
Here are my telnets from FreeBSD to CentOS:
Here are my telnets from CentOS to FreeBSD:
Here are the applicable rules in CentOS iptables:
My
My
x.x.x.x will be FreeBSD's IP
y.y.y.y will be CentOS's IP
Here are my telnets from FreeBSD to CentOS:
Code:
# telnet y.y.y.y 80
Trying y.y.y.y...
Connected to y.y.y.y.static.xxxxxx.com.
Escape character is '^]'.
Code:
# telnet y.y.y.y 27960
Trying y.y.y.y...
telnet: connect to address y.y.y.y: Connection refused
telnet: Unable to connect to remote host
Here are my telnets from CentOS to FreeBSD:
Code:
# telnet x.x.x.x 80
Trying x.x.x.x4...
Connected to x.x.x.x.
Escape character is '^]'.
Code:
# telnet x.x.x.x 27960
Trying x.x.x.x...
telnet: connect to address x.x.x.x: Connection refused
Here are the applicable rules in CentOS iptables:
Code:
# Generated by iptables-save v1.4.7 on Thu Aug 8 22:43:38 2013
*filter
:INPUT ACCEPT [1]
:FORWARD ACCEPT [9]
:OUTPUT ACCEPT [60]
:l - [0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p gre -j ACCEPT
## SSH
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
## Add your ports you want to accept
-A FORWARD -p tcp -m tcp --dport 80 -m state --state NEW,RELATED,ESTABLISHED
-A FORWARD -p tcp -m tcp --dport 27960 -m state --state NEW,RELATED,ESTABLISHED
-A FORWARD -p udp -m udp --dport 80 -m state --state NEW,RELATED,ESTABLISHED
-A FORWARD -p udp -m udp --dport 27960-m state --state NEW,RELATED,ESTABLISHED
## Default reject non-defined stuff
#-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-A INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Thu Aug 8 22:43:38 2013
# Generated by iptables-save v1.4.7 on Thu Aug 8 22:43:38 2013
*nat
:PREROUTING ACCEPT [2]
:POSTROUTING ACCEPT [0]
:OUTPUT ACCEPT [1]
## Add your ports that live on the FreeBSD server here
-A PREROUTING -p tcp -m tcp --dport 80 -m state --state NEW,RELATED,ESTABLISHED -j DNAT --to-destination 10.0.0.1:80
-A PREROUTING -p tcp -m tcp --dport 27960-m state --state NEW,RELATED,ESTABLISHED -j DNAT --to-destination 10.0.0.1:27960
-A PREROUTING -p udp -m udp --dport 80 -m state --state NEW,RELATED,ESTABLISHED -j DNAT --to-destination 10.0.0.1:80
-A PREROUTING -p udp -m udp --dport 27960 -m state --state NEW,RELATED,ESTABLISHED -j DNAT --to-destination 10.0.0.1:27960
-A POSTROUTING -j MASQUERADE
COMMIT
# Completed on Thu Aug 8 22:43:38 2013
My
ifconfig
on FreeBSD (IPv6 replaced with 0s):
Code:
# ifconfig
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO>
ether 00:1b:24:5b:eb:7c
inet x.x.x.x netmask 0xfffffffc broadcast x.x.x.x
inet6 0000::000:0000:0000:0000%em0 prefixlen 64 scopeid 0x1
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
em1: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO>
ether 00:1b:24:5b:eb:7d
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: Ethernet autoselect
status: no carrier
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 0000::1%lo0 prefixlen 64 scopeid 0x8
inet 127.0.0.1 netmask 0xff000000
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
pflog0: flags=141<UP,RUNNING,PROMISC> metric 0 mtu 33152
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
gre0: flags=9051<UP,POINTOPOINT,RUNNING,LINK0,MULTICAST> metric 0 mtu 1476
tunnel inet 1x.x.x.x --> y.y.y.y
inet 10.0.0.1 --> 10.0.0.2 netmask 0xfffffffc
inet6 fe80::21b:24ff:fe5b:eb7c%gre0 prefixlen 64 scopeid 0xa
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
My
ifconfig
on CentOS:
Code:
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:3C:B9:49:E7
inet addr:y.y.y.y Bcast:y.y.y.y Mask:255.255.255.255
inet6 addr: 0000::000:0000:000:0000/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:45984 errors:0 dropped:0 overruns:0 frame:0
TX packets:8182 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3519237 (3.3 MiB) TX bytes:2175342 (2.0 MiB)
Interrupt:11 Base address:0x2000
gre5 Link encap:UNSPEC HWaddr C6-37-6A-0D-00-00-E1-8E-00-00-00-00-00-00-00-00
inet addr:10.0.0.2 P-t-P:10.0.0.2 Mask:255.255.255.252
UP POINTOPOINT RUNNING NOARP MTU:1476 Metric:1
RX packets:1198 errors:0 dropped:0 overruns:0 frame:0
TX packets:1376 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1037684 (1013.3 KiB) TX bytes:131590 (128.5 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1 errors:0 dropped:0 overruns:0 frame:0
TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:112 (112.0 b) TX bytes:112 (112.0 b)