0

I want to forward :80 connections to one of my lxc containers. I've used iptables for ipv4, and when I try to do it with ip6tables it fail because it understand :80 as part of the IP.

I've tried :

# ip6tables -t nat -I PREROUTING -i eth0 -p TCP -d <my_server_ipv6> --dport 80 -j DNAT --to-destination <my_container_ipv6>:80

Bad IP address "<my_container_ipv6>:80"

(and I can't use my container's IPv4 because ip6tables want only IPv6).

How can I differentiate the IP from the port ?

  • You e already got —dport 80, why are you putting :80 after the IP address? They don’t go together in the ip address field like that. – Appleoddity Jun 10 '18 at 15:45
  • @Appleoddity : Well for iptables (with ipv4) it works well with :80 after the IP adress. I tough --dport 80 apply only to the first IP – Nino Treyssat-Vincent Jun 10 '18 at 15:47
  • Sorry, just briefly looking this up it appears you need brackets around the IP. [IPv6 address]:80 – Appleoddity Jun 10 '18 at 15:48
  • @Appleoddity That was it ! (I had to escape the brackets) – Nino Treyssat-Vincent Jun 10 '18 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.