Is it possible to bind an arbitrary port, say 1337, to a specific NIC? I have 2 NICs, one configured for IPv4, the other for IPv6. I want to ensure that whenever port 1337 is used, it goes through the IPv6 interface.
Asked
Active
Viewed 5,011 times
2 Answers
1
I think that you can do that using iptables. A rule in IP table should do it, but I think that the NIC in question has to have a IP assigned to it. Try this, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
iptables -A PREROUTING -p tcp --dport xxxx -i eth1
Replace xxxx with the port number. For more info on iptables see the Manpage

Mitch
- 107,631
0
You usually bind a service (that uses a certain port) to an address. So when you bind your service to the IPv6 address you should be set.

guntbert
- 13,134
iptables -t nat -A PREROUTING -p tcp --dport 10337 -i eth1
I need a solution that works for IPv6, which doesn't have a nat table.
– bbbgscott Jul 16 '13 at 17:23