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

I have an vps which has two interfaces:

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:113 errors:0 dropped:0 overruns:0 frame:0
      TX packets:113 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
          RX bytes:11005 (11.0 KB)  TX bytes:11005 (11.0 KB)

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:127.0.0.1  P-t-P:127.0.0.1  Bcast:0.0.0.0  Mask:255.255.255.255
          inet6 addr: ::1/128 Scope:Host
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
          RX packets:714 errors:0 dropped:0 overruns:0 frame:0
          TX packets:604 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:108787 (108.7 KB)  TX bytes:281389 (281.3 KB)

venet0:0  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:87.118.124.244  P-t-P:87.118.124.244  Bcast:0.0.0.0  Mask:255.255.255.255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1

venet0:1  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:87.118.125.244  P-t-P:87.118.125.244  Bcast:0.0.0.0  Mask:255.255.255.255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1

iptables -t nat -A POSTROUTING -o vnet0:0 -j MASQUERADE

Warning: weird character in interface `vnet0:0' (No aliases, :, ! or *).
iptables: No chain/target/match by that name.

I tried to change interface names but I couldn't. Any suggestions?

share|improve this question

2 Answers 2

I can see two issues. You've got a typo in saying vnet0 instead of venet0, and you're trying to configure a rule on an IP alias.

This question on using iptables with IP aliases should help you with the second issue.

share|improve this answer
    
Actually, thanks for replying back. I tried venet0:0 still same error. I am trying to setup pptp vpn server on my vps. like in this example dikant.de/2010/10/08/setting-up-a-vpn-server-on-amazon-ec2 –  snagcheol May 30 '11 at 8:36
    
My answer pointed out two issues. The second issue is that you can't enable rules on IP aliases (that is, interfaces with : in their name). See the link in my answer for ways of achieving the desired result. –  Tom Shaw May 30 '11 at 8:39

I couldn't use MASQUERADE as it hasn't been virtualized as a module, and that I should use SNAT instead.

This is the command I used, hope it helps someone else!

iptables -t nat -A POSTROUTING -s 0.0.0.0/24 -j SNAT --to-source <one of my external IPs>
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.