Questions tagged [dnat]

92 questions
1
vote
1 answer

Original IP lost with IPTables NAT to another server

I'm trying to forward all HTTP traffic from one EC2 linux server (external IP 11.11.11.11) to another one (external IP 22.22.22.22), these rules set: sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 22.22.22.22:80 sudo…
Kof
  • 143
  • 1
  • 4
1
vote
0 answers

iptables foward to multiple interfaces with NAT

I want to use iptables for provide NAT translation and forward the packets out a different interface. The network set-up is as follows: Alias: eth0:220 with IP address 10.1.1.220 / 255.255.252.0 eth0:221 with IP address 10.1.1.221 /…
1
vote
1 answer

Using host's iptables to prevent access to docker-container's exposed ports

I have a host which runs a few docker's containers. This host has a few network interfaces, my goal is make some exposed ports from containers accessible only by certain interfaces, and prevent access from others. I would like to use host's iptables…
Korjavin Ivan
  • 2,230
  • 2
  • 25
  • 39
1
vote
1 answer

iptables dnat mapping to specific ip

I constructed a private net with two machine, both of them have two network interfaces this is the networking information: machine1: eth0 10.0.0.11 (private net) eth1 10.82.80.208 (Campus Network ip) machine2: eth0 10.0.0.21 (private net) eth2…
user260787
  • 11
  • 1
1
vote
2 answers

Port forward with iptables

I got lo (127.0.0.1) and eth0 (172.17.0.8). I want to redirect packets that land on 127.0.0.1:80 to 172.17.42.1:80 (route from eth0). I tried iptables -t nat -A OUTPUT -p tcp --dport 80 -d 127.0.0.1 -j DNAT --to 172.17.42.1:80 But when I do curl…
1
vote
1 answer

Are iptables prerouting (DNAT) packet changes visible to subsequent chains?

I was reading Rusty Russell's NAT Howto when I came across this section: 6.2. Destination NAT This is done in the PREROUTING chain, just as the packet comes in; this means that anything else on the Linux box itself (routing, packet …
Robin
  • 295
  • 1
  • 3
  • 9
1
vote
1 answer

Linux iptables DNAT 53306 to 127.0.0.1 3306

mysql real port is 3306。 I want public network using 53306 to visit mysql,and 3306 not allowed access from public network. How to write the iptables rules DNAT 53306 to 127.0.0.1 3306 ? help me
ikool
  • 11
  • 1
1
vote
1 answer

Redirect traffic from one server to something.cloudapp.net (CNAME)

Through out North America, we have lots of legacy devices, which sends data to our server which has static IP Address. Now we are moving to Azure cloud services, and as you know they do not guarantee static ip address. And there is no way to…
1
vote
1 answer

netfilter DNAT rule doesn't work for local traffic

I have a webserver hidden behind a firewall. A DNAT rule on my firewall makes it reachable for visitors from the internet. The rule works for traffic from the internet. Unfortunately it doesn't work (or only in parts) for traffic coming from the…
Thorsten
  • 158
  • 5
1
vote
2 answers

NAT from Pvt ip to PublicIP

I have a gateway machine with 2 NIC: eth0 with public IP and eth1 with private IP. On eth0 I have 4 public IP aliased, I wanted to NAT public IP to private IP and I used DNAT to do that uisng iptables. 1.1.1.2 -> 10.10.10.2 1.1.1.3 ->…
kevin
  • 191
  • 5
  • 15
1
vote
1 answer

DNAT generically?

How would you setup iptables to generically send packets of some port say tcp port 80 to the correct machines (which are not all in the same subnet)? For ex: iptables -t nat -A PREROUTING -s 0.0.0.0//0 -p tcp -d $NATIP -j DNAT --to-destination…
kevin
  • 13
  • 2
1
vote
0 answers

NAT Public ip to that many number of pvt ip

i have a Linux box with two interfaces one with ip 10.10.18.2 and other with ip 192.168.1.2,192.168.1.3 aliased. A xen host is connected with ip 10.10.18.3 and gateway 10.10.18.2 to this through a switch. on Xen host 2 vms are running with ip…
kevin
  • 191
  • 5
  • 15
1
vote
0 answers

ejabberd on vm not connect to another xmmp server (iptables dnat dport 5269)

i migrate a ejabberd server to a vm with only private ip. is work fine but not connect to anothers xmmp servers. log: s2s connection: xxxx -> gmail.com (remote server not found) telnet test: telnet xmpp-server.l.google.com 5269 Connection time…
bl4ckb1rd
  • 11
  • 1
1
vote
0 answers

openstack, bridging, netfilter and dnat

In a recent upgrade (from Openstack Diablo on Ubuntu Lucid to Openstack Essex on Ubuntu Precise), we found that DNS packets were frequently (almost always) dropped on the bridge interface (br100). For our compute-node hosts, that's a Mellanox…
cas
  • 6,653
  • 31
  • 34
1
vote
2 answers

How to DNAT to different local IP based on what public IP was accessed with Shorewall?

My server has several public IPs, and is running a bunch of virtual machines with private IP adresses. As an example, I want to map ports 80, 443 and 8080 on 232.21.23.23 (public) to 192.168.122.12 (private). I have tried a couple of different NAT…
mikl
  • 612
  • 1
  • 11
  • 17