How to forward OpenVPN Port to NAT'd XEN domU

Posted by John on Server Fault See other posts from Server Fault or by John
Published on 2011-11-24T12:27:26Z Indexed on 2012/09/24 15:39 UTC
Read the original article Hit count: 267

Filed under:
|
|
|

I want to install a OpenVPN domU on XEN. Dom0 and domU are running Debian Squeeze, all domU are on a NAT'd privat network 10.0.0.1/24 My VPN-Gate is von 10.0.0.1 and running. How can I make it accessible under the dom0 public IP?

I tried forwarding the port using iptables, but without any success.

Here is what i did:

~ # iptables -L -n -v
Chain INPUT (policy ACCEPT 1397 packets, 118K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 930 packets, 133K bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED PHYSDEV match --physdev-out vif5.0 
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           PHYSDEV match --physdev-in vif5.0 udp spt:68 dpt:67 
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED PHYSDEV match --physdev-out vif5.0 
    0     0 ACCEPT     all  --  *      *       10.0.0.1             0.0.0.0/0           PHYSDEV match --physdev-in vif5.0 
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED PHYSDEV match --physdev-out vif3.0 
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           PHYSDEV match --physdev-in vif3.0 udp spt:68 dpt:67 
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED PHYSDEV match --physdev-out vif3.0 
    0     0 ACCEPT     all  --  *      *       10.0.0.5             0.0.0.0/0           PHYSDEV match --physdev-in vif3.0 
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED PHYSDEV match --physdev-out vif2.0 
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           PHYSDEV match --physdev-in vif2.0 udp spt:68 dpt:67 
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED PHYSDEV match --physdev-out vif2.0 
    0     0 ACCEPT     all  --  *      *       10.0.0.2             0.0.0.0/0           PHYSDEV match --physdev-in vif2.0 
  147  8236 ACCEPT     tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:80 
   13   546 ACCEPT     udp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           udp dpt:1194 

Chain OUTPUT (policy ACCEPT 1000 packets, 99240 bytes)
 pkts bytes target     prot opt in     out     source               destination  


~ # iptables -L -t nat -n -v

Chain PREROUTING (policy ACCEPT 324 packets, 23925 bytes)
 pkts bytes target     prot opt in     out     source               destination         
  139  7824 DNAT       tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80 to:10.0.0.5:80 
    1    42 DNAT       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:1194 to:10.0.0.1:1194 

Chain POSTROUTING (policy ACCEPT 92 packets, 5030 bytes)
 pkts bytes target     prot opt in     out     source               destination         
  863 64983 MASQUERADE  all  --  *      eth0    0.0.0.0/0            0.0.0.0/0           
    0     0 MASQUERADE  all  --  *      eth0    0.0.0.0/0            0.0.0.0/0           
    0     0 MASQUERADE  all  --  *      eth0    0.0.0.0/0            0.0.0.0/0           

Chain OUTPUT (policy ACCEPT 180 packets, 13953 bytes)
 pkts bytes target     prot opt in     out     source               destination   

© Server Fault or respective owner

Related posts about iptables

Related posts about xen