Redirecting all IP over USB traffic to a fixed address
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
Say I have a device connected by IP over USB to my computer (running Ubuntu), that connects to 10.0.0.1. I configured my Ubuntu's Wifi over USB so that my computer's IP on that connection is 10.0.0.1, but I would actually like to redirect all traffic (on all ports) to another server, and just use my computer as a proxy.
I played around with some solutions, but my lack of familiarity with network concepts is slowing me down (I spend too much time looking stuff up, and the documentation is often a bit lacking). I'm not even sure if I want to set up a proxy, a firewall (I don't think so), or use the routing tables. What I want to do sounds pretty simple ("redirect anything coming from IP over USB to that server over there"). So is there a standard way of doing that? iptables? squid? ufw?
linux networking iptables
migrated from serverfault.com Aug 12 '13 at 15:03
This question came from our site for system and network administrators.
add a comment |Â
up vote
1
down vote
favorite
Say I have a device connected by IP over USB to my computer (running Ubuntu), that connects to 10.0.0.1. I configured my Ubuntu's Wifi over USB so that my computer's IP on that connection is 10.0.0.1, but I would actually like to redirect all traffic (on all ports) to another server, and just use my computer as a proxy.
I played around with some solutions, but my lack of familiarity with network concepts is slowing me down (I spend too much time looking stuff up, and the documentation is often a bit lacking). I'm not even sure if I want to set up a proxy, a firewall (I don't think so), or use the routing tables. What I want to do sounds pretty simple ("redirect anything coming from IP over USB to that server over there"). So is there a standard way of doing that? iptables? squid? ufw?
linux networking iptables
migrated from serverfault.com Aug 12 '13 at 15:03
This question came from our site for system and network administrators.
3
For this use case, forget about USB. The network device driver presents the hardware in exactly the same way as any other network device. So if you find a generic solution, it will work for this, or any other Ethernet device.
â EEAA
Aug 12 '13 at 14:19
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Say I have a device connected by IP over USB to my computer (running Ubuntu), that connects to 10.0.0.1. I configured my Ubuntu's Wifi over USB so that my computer's IP on that connection is 10.0.0.1, but I would actually like to redirect all traffic (on all ports) to another server, and just use my computer as a proxy.
I played around with some solutions, but my lack of familiarity with network concepts is slowing me down (I spend too much time looking stuff up, and the documentation is often a bit lacking). I'm not even sure if I want to set up a proxy, a firewall (I don't think so), or use the routing tables. What I want to do sounds pretty simple ("redirect anything coming from IP over USB to that server over there"). So is there a standard way of doing that? iptables? squid? ufw?
linux networking iptables
Say I have a device connected by IP over USB to my computer (running Ubuntu), that connects to 10.0.0.1. I configured my Ubuntu's Wifi over USB so that my computer's IP on that connection is 10.0.0.1, but I would actually like to redirect all traffic (on all ports) to another server, and just use my computer as a proxy.
I played around with some solutions, but my lack of familiarity with network concepts is slowing me down (I spend too much time looking stuff up, and the documentation is often a bit lacking). I'm not even sure if I want to set up a proxy, a firewall (I don't think so), or use the routing tables. What I want to do sounds pretty simple ("redirect anything coming from IP over USB to that server over there"). So is there a standard way of doing that? iptables? squid? ufw?
linux networking iptables
linux networking iptables
edited Aug 21 at 8:18
Rui F Ribeiro
36.7k1271116
36.7k1271116
asked Aug 12 '13 at 14:14
Emile
1063
1063
migrated from serverfault.com Aug 12 '13 at 15:03
This question came from our site for system and network administrators.
migrated from serverfault.com Aug 12 '13 at 15:03
This question came from our site for system and network administrators.
3
For this use case, forget about USB. The network device driver presents the hardware in exactly the same way as any other network device. So if you find a generic solution, it will work for this, or any other Ethernet device.
â EEAA
Aug 12 '13 at 14:19
add a comment |Â
3
For this use case, forget about USB. The network device driver presents the hardware in exactly the same way as any other network device. So if you find a generic solution, it will work for this, or any other Ethernet device.
â EEAA
Aug 12 '13 at 14:19
3
3
For this use case, forget about USB. The network device driver presents the hardware in exactly the same way as any other network device. So if you find a generic solution, it will work for this, or any other Ethernet device.
â EEAA
Aug 12 '13 at 14:19
For this use case, forget about USB. The network device driver presents the hardware in exactly the same way as any other network device. So if you find a generic solution, it will work for this, or any other Ethernet device.
â EEAA
Aug 12 '13 at 14:19
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
What you are asking for is known as a NAT
, a Network Address Translation. There are a number of tools that can provide NAT functionality, but at the IP address level it is probably easiest with iptables:
iptables -t nat -I PREROUTING -d 10.0.0.1 --j DNAT --to 10.x.x.x
in the special nat table of iptables -t nat
, insert at the first rule on the PREROUTING chain (-I PREROUTING
), providing a destination nat -j DNAT
where the incoming destination IP is to 10.0.0.1 (-d 10.0.0.1
) over to the host 10.x.x.x (--to 10.x.x.x
).
You may also need enable IP Fowarding, so your host acts as a network router with:
sysctl -w net.ipv4.ip_forward=1
And that should be it! (Just as simple as you thought it might be!)
Oh and both of these need to be ran as the root user, or via sudo (if you have access to run those commands via sudo!)
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
What you are asking for is known as a NAT
, a Network Address Translation. There are a number of tools that can provide NAT functionality, but at the IP address level it is probably easiest with iptables:
iptables -t nat -I PREROUTING -d 10.0.0.1 --j DNAT --to 10.x.x.x
in the special nat table of iptables -t nat
, insert at the first rule on the PREROUTING chain (-I PREROUTING
), providing a destination nat -j DNAT
where the incoming destination IP is to 10.0.0.1 (-d 10.0.0.1
) over to the host 10.x.x.x (--to 10.x.x.x
).
You may also need enable IP Fowarding, so your host acts as a network router with:
sysctl -w net.ipv4.ip_forward=1
And that should be it! (Just as simple as you thought it might be!)
Oh and both of these need to be ran as the root user, or via sudo (if you have access to run those commands via sudo!)
add a comment |Â
up vote
4
down vote
What you are asking for is known as a NAT
, a Network Address Translation. There are a number of tools that can provide NAT functionality, but at the IP address level it is probably easiest with iptables:
iptables -t nat -I PREROUTING -d 10.0.0.1 --j DNAT --to 10.x.x.x
in the special nat table of iptables -t nat
, insert at the first rule on the PREROUTING chain (-I PREROUTING
), providing a destination nat -j DNAT
where the incoming destination IP is to 10.0.0.1 (-d 10.0.0.1
) over to the host 10.x.x.x (--to 10.x.x.x
).
You may also need enable IP Fowarding, so your host acts as a network router with:
sysctl -w net.ipv4.ip_forward=1
And that should be it! (Just as simple as you thought it might be!)
Oh and both of these need to be ran as the root user, or via sudo (if you have access to run those commands via sudo!)
add a comment |Â
up vote
4
down vote
up vote
4
down vote
What you are asking for is known as a NAT
, a Network Address Translation. There are a number of tools that can provide NAT functionality, but at the IP address level it is probably easiest with iptables:
iptables -t nat -I PREROUTING -d 10.0.0.1 --j DNAT --to 10.x.x.x
in the special nat table of iptables -t nat
, insert at the first rule on the PREROUTING chain (-I PREROUTING
), providing a destination nat -j DNAT
where the incoming destination IP is to 10.0.0.1 (-d 10.0.0.1
) over to the host 10.x.x.x (--to 10.x.x.x
).
You may also need enable IP Fowarding, so your host acts as a network router with:
sysctl -w net.ipv4.ip_forward=1
And that should be it! (Just as simple as you thought it might be!)
Oh and both of these need to be ran as the root user, or via sudo (if you have access to run those commands via sudo!)
What you are asking for is known as a NAT
, a Network Address Translation. There are a number of tools that can provide NAT functionality, but at the IP address level it is probably easiest with iptables:
iptables -t nat -I PREROUTING -d 10.0.0.1 --j DNAT --to 10.x.x.x
in the special nat table of iptables -t nat
, insert at the first rule on the PREROUTING chain (-I PREROUTING
), providing a destination nat -j DNAT
where the incoming destination IP is to 10.0.0.1 (-d 10.0.0.1
) over to the host 10.x.x.x (--to 10.x.x.x
).
You may also need enable IP Fowarding, so your host acts as a network router with:
sysctl -w net.ipv4.ip_forward=1
And that should be it! (Just as simple as you thought it might be!)
Oh and both of these need to be ran as the root user, or via sudo (if you have access to run those commands via sudo!)
edited Aug 12 '13 at 23:55
answered Aug 12 '13 at 22:03
Drav Sloan
9,20023038
9,20023038
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f86439%2fredirecting-all-ip-over-usb-traffic-to-a-fixed-address%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
3
For this use case, forget about USB. The network device driver presents the hardware in exactly the same way as any other network device. So if you find a generic solution, it will work for this, or any other Ethernet device.
â EEAA
Aug 12 '13 at 14:19