
Any help appreciated.
Moderator: General Moderators
Code: Select all
iptables -t nat -I PREROUTING -i eth0 -p tcp -d 1.1.1.1 --dport 8080 -j DNAT --to-destination 2.2.2.2:80
iptables -I FORWARD -p tcp -s 2.2.2.2 --sport 80 -j ACCEPT
iptables -I FORWARD -p tcp -d 2.2.2.2 --dport 80 -j ACCEPTCode: Select all
/sbin/route add default gw 2.2.2.1 metric 1Code: Select all
fernandez:~ # ifconfig
eth0 Link encap:Ethernet HWaddr 00:14:85:06:FA:14
inet addr:10.0.1.49 Bcast:10.0.1.255 Mask:255.255.255.0
inet6 addr: fe80::214:85ff:fe06:fa14/64 Scope:Link
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4679515 errors:0 dropped:0 overruns:0 frame:0
TX packets:2869820 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1041429383 (993.1 Mb) TX bytes:238193207 (227.1 Mb)
Interrupt:177 Base address:0xc000
eth0:stag Link encap:Ethernet HWaddr 00:14:85:06:FA:14
inet addr:10.0.1.50 Bcast:10.0.1.255 Mask:255.255.255.0
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:177 Base address:0xc000
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:14009 errors:0 dropped:0 overruns:0 frame:0
TX packets:14009 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:20708692 (19.7 Mb) TX bytes:20708692 (19.7 Mb)Code: Select all
Basilisk-Lizard:~ # ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:3E:A2:90:63
inet addr:10.0.1.101 Bcast:10.0.1.255 Mask:255.255.255.0
inet6 addr: fe80::216:3eff:fea2:9063/64 Scope:Link
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:391276 errors:0 dropped:0 overruns:0 frame:0
TX packets:13091 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:54623375 (52.0 Mb) TX bytes:2943558 (2.8 Mb)
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:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:560 (560.0 b) TX bytes:560 (560.0 b)Code: Select all
iptables -t nat -I PREROUTING -i eth0 -p tcp -d 10.0.1.49 --dport 8080 -j DNAT --to-destination 10.0.1.101:80
iptables -I FORWARD -s 10.0.1.101 --sport 80 -j ACCEPT
iptables -I FORWARD -d 10.0.1.101 --dport 80 -j ACCEPTCode: Select all
/sbin/route add default gw 10.0.1.50 metric 1Yes, I think so. But I would strongly suggest not to mess up with your ISP subnets, but to choose other for your private network - e.g. 192.168.12.0/24. Use 2 IPs of this network for eth0:stag and Server2.jeffery wrote: does that mean all I have to do is execute on Server 1:and then execute on Server 2:Code: Select all
iptables -t nat -I PREROUTING -i eth0 -p tcp -d 10.0.1.49 --dport 8080 -j DNAT --to-destination 10.0.1.101:80 iptables -I FORWARD -s 10.0.1.101 --sport 80 -j ACCEPT iptables -I FORWARD -d 10.0.1.101 --dport 80 -j ACCEPTWould you be kind in explaining to me what each of those commands perform. ThanksCode: Select all
/sbin/route add default gw 10.0.1.50 metric 1
Hi VladSun,VladSun wrote:By the way, jeffery, you have private IP address assigned by your ISP. So, you don't have a public IP. This mean that you are behind a NAT router and most probably you can't have any kind of Internet service accessible from outside (i.e. Internet).
Is this the case or you gave us fake IPs?
These are in-fact private ip's.. but as I said above the public ip is associated depending on the mac-address of the machine connected to the network. I don't know how this is done as I am not the main person who set it up.VladSun wrote:is this the case or you gave us fake IPs?
Code: Select all
iptables -I FORWARD -s 2.2.2.2 --sport 80 -j ACCEPT
iptables -I FORWARD -d 2.2.2.2 --dport 80 -j ACCEPT