Share internet over ethernet
up vote
2
down vote
favorite
I have two wired connections of which the first has internet via static IPv4 and gateway and the second connects to another network.
I want to share internet from first connection over second connection with a different IP-address.
networking internet
|
show 1 more comment
up vote
2
down vote
favorite
I have two wired connections of which the first has internet via static IPv4 and gateway and the second connects to another network.
I want to share internet from first connection over second connection with a different IP-address.
networking internet
That is posible. And not hard to do. So what did you already try and where did you run into problems?
– Hennes
Jun 7 '15 at 13:44
I edit erh0 to ipv4=85.185.254.69,255.255.255.0,85.185.254.66 which have internet from network 1 and want to share this internet connection to eth1 into another network with ip range 185.185.185.1
– sajadsarlak
Jun 7 '15 at 14:05
Step 1: Configure eth1 with the new network range. Step 2: Confitgure other computers on this network and test/ping. They will use NIC2 on computer 1 (185.185.185.1) as gateway. Step 3) Now you need to forward packets between the two interfaces. Your computer does this based on its routing table. If that does not for check if ipforwarding is enabled. (sysctl net.ipv4.ip_forward should return 1. If it returns 0 then useecho 1 > /proc/sys/net/ipv4/ip_forward
orsysctl -w net.ipv4.ip_forward=1
).
– Hennes
Jun 7 '15 at 14:08
[SOLVED] step 1: eth0 configurated to ipv4=85.185.254.69,255.255.255.0,85.185.254.66,dns=4.2.2.4. step 2: eth1 configurated to ipv4=185.185.185.1,255.255.255.0,85.185.254.69. step 3: Restart ubuntu. step 4: open terminal and run : sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward' sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
– sajadsarlak
Jun 7 '15 at 16:04
@sajadsarlak - if you add that as a answer so it readable, it will help future users who need help - it can also get upvoted too :)
– Wilf
Jun 7 '15 at 16:14
|
show 1 more comment
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I have two wired connections of which the first has internet via static IPv4 and gateway and the second connects to another network.
I want to share internet from first connection over second connection with a different IP-address.
networking internet
I have two wired connections of which the first has internet via static IPv4 and gateway and the second connects to another network.
I want to share internet from first connection over second connection with a different IP-address.
networking internet
networking internet
edited Dec 3 '17 at 19:06
Zanna
49k13123234
49k13123234
asked Jun 7 '15 at 12:53
sajadsarlak
715
715
That is posible. And not hard to do. So what did you already try and where did you run into problems?
– Hennes
Jun 7 '15 at 13:44
I edit erh0 to ipv4=85.185.254.69,255.255.255.0,85.185.254.66 which have internet from network 1 and want to share this internet connection to eth1 into another network with ip range 185.185.185.1
– sajadsarlak
Jun 7 '15 at 14:05
Step 1: Configure eth1 with the new network range. Step 2: Confitgure other computers on this network and test/ping. They will use NIC2 on computer 1 (185.185.185.1) as gateway. Step 3) Now you need to forward packets between the two interfaces. Your computer does this based on its routing table. If that does not for check if ipforwarding is enabled. (sysctl net.ipv4.ip_forward should return 1. If it returns 0 then useecho 1 > /proc/sys/net/ipv4/ip_forward
orsysctl -w net.ipv4.ip_forward=1
).
– Hennes
Jun 7 '15 at 14:08
[SOLVED] step 1: eth0 configurated to ipv4=85.185.254.69,255.255.255.0,85.185.254.66,dns=4.2.2.4. step 2: eth1 configurated to ipv4=185.185.185.1,255.255.255.0,85.185.254.69. step 3: Restart ubuntu. step 4: open terminal and run : sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward' sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
– sajadsarlak
Jun 7 '15 at 16:04
@sajadsarlak - if you add that as a answer so it readable, it will help future users who need help - it can also get upvoted too :)
– Wilf
Jun 7 '15 at 16:14
|
show 1 more comment
That is posible. And not hard to do. So what did you already try and where did you run into problems?
– Hennes
Jun 7 '15 at 13:44
I edit erh0 to ipv4=85.185.254.69,255.255.255.0,85.185.254.66 which have internet from network 1 and want to share this internet connection to eth1 into another network with ip range 185.185.185.1
– sajadsarlak
Jun 7 '15 at 14:05
Step 1: Configure eth1 with the new network range. Step 2: Confitgure other computers on this network and test/ping. They will use NIC2 on computer 1 (185.185.185.1) as gateway. Step 3) Now you need to forward packets between the two interfaces. Your computer does this based on its routing table. If that does not for check if ipforwarding is enabled. (sysctl net.ipv4.ip_forward should return 1. If it returns 0 then useecho 1 > /proc/sys/net/ipv4/ip_forward
orsysctl -w net.ipv4.ip_forward=1
).
– Hennes
Jun 7 '15 at 14:08
[SOLVED] step 1: eth0 configurated to ipv4=85.185.254.69,255.255.255.0,85.185.254.66,dns=4.2.2.4. step 2: eth1 configurated to ipv4=185.185.185.1,255.255.255.0,85.185.254.69. step 3: Restart ubuntu. step 4: open terminal and run : sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward' sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
– sajadsarlak
Jun 7 '15 at 16:04
@sajadsarlak - if you add that as a answer so it readable, it will help future users who need help - it can also get upvoted too :)
– Wilf
Jun 7 '15 at 16:14
That is posible. And not hard to do. So what did you already try and where did you run into problems?
– Hennes
Jun 7 '15 at 13:44
That is posible. And not hard to do. So what did you already try and where did you run into problems?
– Hennes
Jun 7 '15 at 13:44
I edit erh0 to ipv4=85.185.254.69,255.255.255.0,85.185.254.66 which have internet from network 1 and want to share this internet connection to eth1 into another network with ip range 185.185.185.1
– sajadsarlak
Jun 7 '15 at 14:05
I edit erh0 to ipv4=85.185.254.69,255.255.255.0,85.185.254.66 which have internet from network 1 and want to share this internet connection to eth1 into another network with ip range 185.185.185.1
– sajadsarlak
Jun 7 '15 at 14:05
Step 1: Configure eth1 with the new network range. Step 2: Confitgure other computers on this network and test/ping. They will use NIC2 on computer 1 (185.185.185.1) as gateway. Step 3) Now you need to forward packets between the two interfaces. Your computer does this based on its routing table. If that does not for check if ipforwarding is enabled. (sysctl net.ipv4.ip_forward should return 1. If it returns 0 then use
echo 1 > /proc/sys/net/ipv4/ip_forward
or sysctl -w net.ipv4.ip_forward=1
).– Hennes
Jun 7 '15 at 14:08
Step 1: Configure eth1 with the new network range. Step 2: Confitgure other computers on this network and test/ping. They will use NIC2 on computer 1 (185.185.185.1) as gateway. Step 3) Now you need to forward packets between the two interfaces. Your computer does this based on its routing table. If that does not for check if ipforwarding is enabled. (sysctl net.ipv4.ip_forward should return 1. If it returns 0 then use
echo 1 > /proc/sys/net/ipv4/ip_forward
or sysctl -w net.ipv4.ip_forward=1
).– Hennes
Jun 7 '15 at 14:08
[SOLVED] step 1: eth0 configurated to ipv4=85.185.254.69,255.255.255.0,85.185.254.66,dns=4.2.2.4. step 2: eth1 configurated to ipv4=185.185.185.1,255.255.255.0,85.185.254.69. step 3: Restart ubuntu. step 4: open terminal and run : sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward' sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
– sajadsarlak
Jun 7 '15 at 16:04
[SOLVED] step 1: eth0 configurated to ipv4=85.185.254.69,255.255.255.0,85.185.254.66,dns=4.2.2.4. step 2: eth1 configurated to ipv4=185.185.185.1,255.255.255.0,85.185.254.69. step 3: Restart ubuntu. step 4: open terminal and run : sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward' sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
– sajadsarlak
Jun 7 '15 at 16:04
@sajadsarlak - if you add that as a answer so it readable, it will help future users who need help - it can also get upvoted too :)
– Wilf
Jun 7 '15 at 16:14
@sajadsarlak - if you add that as a answer so it readable, it will help future users who need help - it can also get upvoted too :)
– Wilf
Jun 7 '15 at 16:14
|
show 1 more comment
3 Answers
3
active
oldest
votes
up vote
3
down vote
I managed to solve this myself. Here are the steps:
eth0
configured like this
ipv4=85.185.254.69,255.255.255.0,85.185.254.66,dns=4.2.2.4.
eth1
configured like this:
ipv4=185.185.185.1,255.255.255.0,85.185.254.69.
- Restart ubuntu.
Open terminal and run:
sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
sudo bash -c 'iptables-save > /etc/iptables/rules.v4'
sudo bash -c 'iptables-restore < /etc/iptables/rules.v4'
add a comment |
up vote
3
down vote
Edit /etc/sysctl.conf
(for example using sudoedit /etc/sysctl.conf
) and search for the following lines:
# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1
And uncomment net.ipv4.ip_forward=1
by removing the #
at the start of the line:
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
Or, to do this in a one line command:
sudo sysctl -w net.ipv4.ip_forward=1
add a comment |
up vote
0
down vote
You could've done it easier than this. If your internet connection is established via some sort of routing device you can just make a VLAN for the connection you want to share internet with to make it to have access to the router subnet.
https://wiki.ubuntu.com/vlan
You can do this in Network Manager GUI easily. Afaik it is available outta box.
Parent device is the interface you want to share internet with. After that go to IPv4 settings and set an IP address for it from the router DHCP range. Voila. You got yourself a shared internet connection.
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
I managed to solve this myself. Here are the steps:
eth0
configured like this
ipv4=85.185.254.69,255.255.255.0,85.185.254.66,dns=4.2.2.4.
eth1
configured like this:
ipv4=185.185.185.1,255.255.255.0,85.185.254.69.
- Restart ubuntu.
Open terminal and run:
sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
sudo bash -c 'iptables-save > /etc/iptables/rules.v4'
sudo bash -c 'iptables-restore < /etc/iptables/rules.v4'
add a comment |
up vote
3
down vote
I managed to solve this myself. Here are the steps:
eth0
configured like this
ipv4=85.185.254.69,255.255.255.0,85.185.254.66,dns=4.2.2.4.
eth1
configured like this:
ipv4=185.185.185.1,255.255.255.0,85.185.254.69.
- Restart ubuntu.
Open terminal and run:
sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
sudo bash -c 'iptables-save > /etc/iptables/rules.v4'
sudo bash -c 'iptables-restore < /etc/iptables/rules.v4'
add a comment |
up vote
3
down vote
up vote
3
down vote
I managed to solve this myself. Here are the steps:
eth0
configured like this
ipv4=85.185.254.69,255.255.255.0,85.185.254.66,dns=4.2.2.4.
eth1
configured like this:
ipv4=185.185.185.1,255.255.255.0,85.185.254.69.
- Restart ubuntu.
Open terminal and run:
sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
sudo bash -c 'iptables-save > /etc/iptables/rules.v4'
sudo bash -c 'iptables-restore < /etc/iptables/rules.v4'
I managed to solve this myself. Here are the steps:
eth0
configured like this
ipv4=85.185.254.69,255.255.255.0,85.185.254.66,dns=4.2.2.4.
eth1
configured like this:
ipv4=185.185.185.1,255.255.255.0,85.185.254.69.
- Restart ubuntu.
Open terminal and run:
sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
sudo bash -c 'iptables-save > /etc/iptables/rules.v4'
sudo bash -c 'iptables-restore < /etc/iptables/rules.v4'
edited Dec 1 '17 at 21:08
Zanna
49k13123234
49k13123234
answered Jun 9 '15 at 3:52
sajadsarlak
715
715
add a comment |
add a comment |
up vote
3
down vote
Edit /etc/sysctl.conf
(for example using sudoedit /etc/sysctl.conf
) and search for the following lines:
# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1
And uncomment net.ipv4.ip_forward=1
by removing the #
at the start of the line:
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
Or, to do this in a one line command:
sudo sysctl -w net.ipv4.ip_forward=1
add a comment |
up vote
3
down vote
Edit /etc/sysctl.conf
(for example using sudoedit /etc/sysctl.conf
) and search for the following lines:
# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1
And uncomment net.ipv4.ip_forward=1
by removing the #
at the start of the line:
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
Or, to do this in a one line command:
sudo sysctl -w net.ipv4.ip_forward=1
add a comment |
up vote
3
down vote
up vote
3
down vote
Edit /etc/sysctl.conf
(for example using sudoedit /etc/sysctl.conf
) and search for the following lines:
# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1
And uncomment net.ipv4.ip_forward=1
by removing the #
at the start of the line:
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
Or, to do this in a one line command:
sudo sysctl -w net.ipv4.ip_forward=1
Edit /etc/sysctl.conf
(for example using sudoedit /etc/sysctl.conf
) and search for the following lines:
# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1
And uncomment net.ipv4.ip_forward=1
by removing the #
at the start of the line:
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
Or, to do this in a one line command:
sudo sysctl -w net.ipv4.ip_forward=1
edited Dec 1 '17 at 21:10
Zanna
49k13123234
49k13123234
answered Jun 9 '15 at 3:56
sajadsarlak
715
715
add a comment |
add a comment |
up vote
0
down vote
You could've done it easier than this. If your internet connection is established via some sort of routing device you can just make a VLAN for the connection you want to share internet with to make it to have access to the router subnet.
https://wiki.ubuntu.com/vlan
You can do this in Network Manager GUI easily. Afaik it is available outta box.
Parent device is the interface you want to share internet with. After that go to IPv4 settings and set an IP address for it from the router DHCP range. Voila. You got yourself a shared internet connection.
add a comment |
up vote
0
down vote
You could've done it easier than this. If your internet connection is established via some sort of routing device you can just make a VLAN for the connection you want to share internet with to make it to have access to the router subnet.
https://wiki.ubuntu.com/vlan
You can do this in Network Manager GUI easily. Afaik it is available outta box.
Parent device is the interface you want to share internet with. After that go to IPv4 settings and set an IP address for it from the router DHCP range. Voila. You got yourself a shared internet connection.
add a comment |
up vote
0
down vote
up vote
0
down vote
You could've done it easier than this. If your internet connection is established via some sort of routing device you can just make a VLAN for the connection you want to share internet with to make it to have access to the router subnet.
https://wiki.ubuntu.com/vlan
You can do this in Network Manager GUI easily. Afaik it is available outta box.
Parent device is the interface you want to share internet with. After that go to IPv4 settings and set an IP address for it from the router DHCP range. Voila. You got yourself a shared internet connection.
You could've done it easier than this. If your internet connection is established via some sort of routing device you can just make a VLAN for the connection you want to share internet with to make it to have access to the router subnet.
https://wiki.ubuntu.com/vlan
You can do this in Network Manager GUI easily. Afaik it is available outta box.
Parent device is the interface you want to share internet with. After that go to IPv4 settings and set an IP address for it from the router DHCP range. Voila. You got yourself a shared internet connection.
edited Nov 20 at 8:36
answered Nov 20 at 8:20
Devolutheist
167
167
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f633372%2fshare-internet-over-ethernet%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
That is posible. And not hard to do. So what did you already try and where did you run into problems?
– Hennes
Jun 7 '15 at 13:44
I edit erh0 to ipv4=85.185.254.69,255.255.255.0,85.185.254.66 which have internet from network 1 and want to share this internet connection to eth1 into another network with ip range 185.185.185.1
– sajadsarlak
Jun 7 '15 at 14:05
Step 1: Configure eth1 with the new network range. Step 2: Confitgure other computers on this network and test/ping. They will use NIC2 on computer 1 (185.185.185.1) as gateway. Step 3) Now you need to forward packets between the two interfaces. Your computer does this based on its routing table. If that does not for check if ipforwarding is enabled. (sysctl net.ipv4.ip_forward should return 1. If it returns 0 then use
echo 1 > /proc/sys/net/ipv4/ip_forward
orsysctl -w net.ipv4.ip_forward=1
).– Hennes
Jun 7 '15 at 14:08
[SOLVED] step 1: eth0 configurated to ipv4=85.185.254.69,255.255.255.0,85.185.254.66,dns=4.2.2.4. step 2: eth1 configurated to ipv4=185.185.185.1,255.255.255.0,85.185.254.69. step 3: Restart ubuntu. step 4: open terminal and run : sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward' sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
– sajadsarlak
Jun 7 '15 at 16:04
@sajadsarlak - if you add that as a answer so it readable, it will help future users who need help - it can also get upvoted too :)
– Wilf
Jun 7 '15 at 16:14