Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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   
share|improve this question

1 Answer 1

up vote 1 down vote accepted

I managed to get it working. The mistake was not inside the package forwarding but the IP routing. I needed to make sure that the VPN-client knows where to find the 10.0.0.0/24 network. That can be done by using OpenVPN's push-route.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.