conducting TCP sessions with non-local IPs
Hello linux-kernel,
Is there any way to conduct TCP sessions (IE have a userland process connect out, or accept connections) using non-local IPs? By "non-local" I just mean IPs that aren't assigned to an interface, but do fall into the network range of a running interface (so netmask, gateway, etc are "known").
For example, I want to bring up an interface for 10.0.0.0/255.255.255.0 and assign it IP 10.0.0.1 Then, I want a process to accept TCP connections on, say, 10.0.0.2:1234 or 10.0.0.200:4567 even though these IPs are not assigned to any interface. Also, I want to be able to connect out with source IP 10.0.0.2 or 10.0.0.200, etc. I will need to be able to do this for potentially all IPs in the network, so bringing up a new IP-aliased interface (eth0:0, eth0:1, etc) is not feasible. Compound that with the fact that I could need to do this for many networks, and clearly doing an "ifconfig up" on all possible IPs is not a very efficient option.
I have tried enabling "ip_nonlocal_bind" and that prevents a bind call to a non-local IP from failing. However, I don't think that's sufficient to conduct full TCP/IP sessions from any IP on the network.
This is a really wierd question, but I'm curious if its possible with current 2.4.X kernels and, if it's not, how difficult would it be to add support for. What areas of the network stack would require modification?
Thanks!
Regards,
Bryan Rittmeyer
Signature · 5 lines
Bryan Rittmeyer mailto:[email protected] Ixia Communications 26601 W. Agoura Rd. Calabasas, CA 91302
Quoted 10 lines · Bryan Rittmeyer
Hello linux-kernel,
Is there any way to conduct TCP sessions (IE have a userland process connect out, or accept connections) using non-local IPs? By "non-local" I just mean IPs that aren't assigned to an interface, but do fall into the network range of a running interface (so netmask, gateway, etc are "known").
For example, I want to bring up an interface for 10.0.0.0/255.255.255.0 and assign it IP 10.0.0.1 Then, I want a process to accept TCP
[snip]
/sbin/ip addr add 10.2.0.0/24 dev eth0
Tada
Quoted 10 lines · Gregory Maxwell
Quoted 8 lines · Bryan Rittmeyer
Hello linux-kernel,
Is there any way to conduct TCP sessions (IE have a userland process connect out, or accept connections) using non-local IPs? By "non-local" I just mean IPs that aren't assigned to an interface, but do fall into the network range of a running interface (so netmask, gateway, etc are "known").
Quoted 7 lines
Quoted 2 lines
For example, I want to bring up an interface for 10.0.0.0/255.255.255.0 and assign it IP 10.0.0.1 Then, I want a process to accept TCP
[snip]
/sbin/ipaddr add 10.2.0.0/24 dev eth0Tada
How would you deal with the other computer responding to the host "port not reachable"?
Quoted 13 lines · Mike Fedyk
Quoted 12 lines · Gregory Maxwell
Quoted 10 lines · Bryan Rittmeyer
Hello linux-kernel,
Is there any way to conduct TCP sessions (IE have a userland process connect out, or accept connections) using non-local IPs? By "non-local" I just mean IPs that aren't assigned to an interface, but do fall into the network range of a running interface (so netmask, gateway, etc are "known").
For example, I want to bring up an interface for 10.0.0.0/255.255.255.0 and assign it IP 10.0.0.1 Then, I want a process to accept TCP
Quoted 7 lines
Quoted 5 lines
[snip]
/sbin/ipaddr add 10.2.0.0/24 dev eth0Tada
How would you deal with the other computer responding to the host "port not reachable"?
I didn't pick-up on the fact that you planned on have other computers listening with those addresses.
This won't work without support from your routing device if you actually have hosts on the addresses, just because of ARP.
You can make this work, if, you can control and configure the router
1. You can configure your router to direct the needed ports to your Linux box and not the real hosts. (Linux can do this)
If you can firewall on the victim boxes, you could block their 'not reachable' reply, but that doesn't solve ARP. You could probably make a trivial change to Linux and run it in promiscuous mode to achieve this. It's more likely the first will be a better option for you.
What are you doing anyways? :)
Quoted 7 lines · Mike Fedyk
Quoted 5 lines
[snip]
/sbin/ipaddr add 10.2.0.0/24 dev eth0Tada
How would you deal with the other computer responding to the host "port not reachable"?
What the hell kind of monster are you making? There's got to be another way.