how can i disable ip forwarding from ipv6 to ipv4

Myra Sewitz asked:

i have ipv4 and ipv6 addresses on my network card, when i send a request with curl i want only the respective ipv4 or ipv6 to be used and no fallback e.g. from ipv6 to ipv4 takes place.

curl --interface XXXX: c020: XXXX: e601: XXXX: 596c: XXXX: db97

curl: (45) bind failed with errno 22: Invalid argument

curl -x http: // [2603: XXXX: 8003: e601: XXXX: 596c: XXXX: db97]: 8080


I would like to receive an error if the site only accepts ipv4 addresses as with the –interface variant.

ipv4 forwarding is switched off.

ubuntu @ app-1: ~ $ sudo grep -r ip_forward / etc

apparently a forwarding takes place anyway when I send it with a port.

please help me

My answer:

You can override which IP protocol stack is used with the -4 and -6 options, which restrict it to IPv4 or IPv6 respectively. Consider:

$ curl -6
curl: (6) Could not resolve host:

$ curl -4
IPv4,,Remaining fields reserved for future use,,,

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.