how to make my raspberry pi act as gateway for eth0 subnet using eth1 internet connection?











up vote
0
down vote

favorite












I have set my lapton and ethernet+wifi router to an 192.168.10.x subnet with fixed IP setting.



I have another subnet on 192.168.9.x range managed by DHCP by a 4G wifi router.



I have a raspberry pi that has an address both to the 10 network (via ethernet) and on the 9 network via usb (seen as eth1 IPv6). How should I configure this raspberry pi to act as gateway and sharethe internet connection available on its eth1 interface to the laptop that is on the 10 network?



Please note I can ping the raspberry pi 10 address from the laptop, so I think I am only missing instructions for the Pi to route things properly and maybe a suitable gateway setting on the laptop.



Here my ifconfig on the various devices



* laptop *



en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether dc:a9:04:6f:28:13
inet6 fe80::1025:32eb:e83:39d2%en0 prefixlen 64 secured scopeid 0xc
inet 192.168.10.123 netmask 0xffffff00 broadcast 192.168.10.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active


* Router *



MAC Address 
00-11-95-2c-f9-e8
IP Address
192.168.10.109
Subnet Mask
255.255.255.0
DHCP Server
Disabled


and the * raspberry *



eth0      Link encap:Ethernet  HWaddr b8:27:eb:09:0a:f5  
inet addr:192.168.10.110 Bcast:192.168.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1842 errors:1 dropped:0 overruns:0 frame:0
TX packets:451 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:482427 (471.1 KiB) TX bytes:89151 (87.0 KiB)

eth1 Link encap:Ethernet HWaddr 00:1e:10:1f:00:00
inet addr:192.168.9.100 Bcast:192.168.9.255 Mask:255.255.255.0
inet6 addr: fe80::b0b4:a7ba:fee8:b03/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:133 errors:0 dropped:0 overruns:0 frame:0
TX packets:173 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:28446 (27.7 KiB) TX bytes:30440 (29.7 KiB)









share|improve this question






















  • Have you tried the "Turn a raspberry into a router" instructions already found elsewhere on the web?
    – grawity
    Nov 25 at 11:47










  • Thanks for chiming in. Yes, I read the manual(s). Forgot to mention that most tutorials use DHCP, and I am not. Besides there is a transition in networking from Jessie to Strech that makes more challenging to follow tutorials.
    – Rho Phi
    Nov 25 at 12:26










  • I have made some progress with iptables (still available in Jessie) sudo iptables -F; sudo iptables -t nat -F; sudo iptables -t nat -A POSTROUTING -o $wlan -j MASQUERADE; sudo iptables -A FORWARD -i $wlan -o $eth -m state --state RELATED,ESTABLISHED -j ACCEPT; sudo iptables -A FORWARD -i $eth -o $wlan -j ACCEPT as here github.com/arpitjindal97/raspbian-recipes/blob/master/…
    – Rho Phi
    Nov 25 at 12:26












  • FYI raspberrypi.stackexchange.com/questions/48307/… is the cleanest Jessie/Strech-aware tutorial I found.
    – Rho Phi
    Nov 25 at 12:30

















up vote
0
down vote

favorite












I have set my lapton and ethernet+wifi router to an 192.168.10.x subnet with fixed IP setting.



I have another subnet on 192.168.9.x range managed by DHCP by a 4G wifi router.



I have a raspberry pi that has an address both to the 10 network (via ethernet) and on the 9 network via usb (seen as eth1 IPv6). How should I configure this raspberry pi to act as gateway and sharethe internet connection available on its eth1 interface to the laptop that is on the 10 network?



Please note I can ping the raspberry pi 10 address from the laptop, so I think I am only missing instructions for the Pi to route things properly and maybe a suitable gateway setting on the laptop.



Here my ifconfig on the various devices



* laptop *



en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether dc:a9:04:6f:28:13
inet6 fe80::1025:32eb:e83:39d2%en0 prefixlen 64 secured scopeid 0xc
inet 192.168.10.123 netmask 0xffffff00 broadcast 192.168.10.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active


* Router *



MAC Address 
00-11-95-2c-f9-e8
IP Address
192.168.10.109
Subnet Mask
255.255.255.0
DHCP Server
Disabled


and the * raspberry *



eth0      Link encap:Ethernet  HWaddr b8:27:eb:09:0a:f5  
inet addr:192.168.10.110 Bcast:192.168.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1842 errors:1 dropped:0 overruns:0 frame:0
TX packets:451 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:482427 (471.1 KiB) TX bytes:89151 (87.0 KiB)

eth1 Link encap:Ethernet HWaddr 00:1e:10:1f:00:00
inet addr:192.168.9.100 Bcast:192.168.9.255 Mask:255.255.255.0
inet6 addr: fe80::b0b4:a7ba:fee8:b03/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:133 errors:0 dropped:0 overruns:0 frame:0
TX packets:173 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:28446 (27.7 KiB) TX bytes:30440 (29.7 KiB)









share|improve this question






















  • Have you tried the "Turn a raspberry into a router" instructions already found elsewhere on the web?
    – grawity
    Nov 25 at 11:47










  • Thanks for chiming in. Yes, I read the manual(s). Forgot to mention that most tutorials use DHCP, and I am not. Besides there is a transition in networking from Jessie to Strech that makes more challenging to follow tutorials.
    – Rho Phi
    Nov 25 at 12:26










  • I have made some progress with iptables (still available in Jessie) sudo iptables -F; sudo iptables -t nat -F; sudo iptables -t nat -A POSTROUTING -o $wlan -j MASQUERADE; sudo iptables -A FORWARD -i $wlan -o $eth -m state --state RELATED,ESTABLISHED -j ACCEPT; sudo iptables -A FORWARD -i $eth -o $wlan -j ACCEPT as here github.com/arpitjindal97/raspbian-recipes/blob/master/…
    – Rho Phi
    Nov 25 at 12:26












  • FYI raspberrypi.stackexchange.com/questions/48307/… is the cleanest Jessie/Strech-aware tutorial I found.
    – Rho Phi
    Nov 25 at 12:30















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have set my lapton and ethernet+wifi router to an 192.168.10.x subnet with fixed IP setting.



I have another subnet on 192.168.9.x range managed by DHCP by a 4G wifi router.



I have a raspberry pi that has an address both to the 10 network (via ethernet) and on the 9 network via usb (seen as eth1 IPv6). How should I configure this raspberry pi to act as gateway and sharethe internet connection available on its eth1 interface to the laptop that is on the 10 network?



Please note I can ping the raspberry pi 10 address from the laptop, so I think I am only missing instructions for the Pi to route things properly and maybe a suitable gateway setting on the laptop.



Here my ifconfig on the various devices



* laptop *



en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether dc:a9:04:6f:28:13
inet6 fe80::1025:32eb:e83:39d2%en0 prefixlen 64 secured scopeid 0xc
inet 192.168.10.123 netmask 0xffffff00 broadcast 192.168.10.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active


* Router *



MAC Address 
00-11-95-2c-f9-e8
IP Address
192.168.10.109
Subnet Mask
255.255.255.0
DHCP Server
Disabled


and the * raspberry *



eth0      Link encap:Ethernet  HWaddr b8:27:eb:09:0a:f5  
inet addr:192.168.10.110 Bcast:192.168.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1842 errors:1 dropped:0 overruns:0 frame:0
TX packets:451 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:482427 (471.1 KiB) TX bytes:89151 (87.0 KiB)

eth1 Link encap:Ethernet HWaddr 00:1e:10:1f:00:00
inet addr:192.168.9.100 Bcast:192.168.9.255 Mask:255.255.255.0
inet6 addr: fe80::b0b4:a7ba:fee8:b03/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:133 errors:0 dropped:0 overruns:0 frame:0
TX packets:173 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:28446 (27.7 KiB) TX bytes:30440 (29.7 KiB)









share|improve this question













I have set my lapton and ethernet+wifi router to an 192.168.10.x subnet with fixed IP setting.



I have another subnet on 192.168.9.x range managed by DHCP by a 4G wifi router.



I have a raspberry pi that has an address both to the 10 network (via ethernet) and on the 9 network via usb (seen as eth1 IPv6). How should I configure this raspberry pi to act as gateway and sharethe internet connection available on its eth1 interface to the laptop that is on the 10 network?



Please note I can ping the raspberry pi 10 address from the laptop, so I think I am only missing instructions for the Pi to route things properly and maybe a suitable gateway setting on the laptop.



Here my ifconfig on the various devices



* laptop *



en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether dc:a9:04:6f:28:13
inet6 fe80::1025:32eb:e83:39d2%en0 prefixlen 64 secured scopeid 0xc
inet 192.168.10.123 netmask 0xffffff00 broadcast 192.168.10.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active


* Router *



MAC Address 
00-11-95-2c-f9-e8
IP Address
192.168.10.109
Subnet Mask
255.255.255.0
DHCP Server
Disabled


and the * raspberry *



eth0      Link encap:Ethernet  HWaddr b8:27:eb:09:0a:f5  
inet addr:192.168.10.110 Bcast:192.168.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1842 errors:1 dropped:0 overruns:0 frame:0
TX packets:451 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:482427 (471.1 KiB) TX bytes:89151 (87.0 KiB)

eth1 Link encap:Ethernet HWaddr 00:1e:10:1f:00:00
inet addr:192.168.9.100 Bcast:192.168.9.255 Mask:255.255.255.0
inet6 addr: fe80::b0b4:a7ba:fee8:b03/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:133 errors:0 dropped:0 overruns:0 frame:0
TX packets:173 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:28446 (27.7 KiB) TX bytes:30440 (29.7 KiB)






linux networking wireless-networking router bridge






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 25 at 11:44









Rho Phi

1112




1112












  • Have you tried the "Turn a raspberry into a router" instructions already found elsewhere on the web?
    – grawity
    Nov 25 at 11:47










  • Thanks for chiming in. Yes, I read the manual(s). Forgot to mention that most tutorials use DHCP, and I am not. Besides there is a transition in networking from Jessie to Strech that makes more challenging to follow tutorials.
    – Rho Phi
    Nov 25 at 12:26










  • I have made some progress with iptables (still available in Jessie) sudo iptables -F; sudo iptables -t nat -F; sudo iptables -t nat -A POSTROUTING -o $wlan -j MASQUERADE; sudo iptables -A FORWARD -i $wlan -o $eth -m state --state RELATED,ESTABLISHED -j ACCEPT; sudo iptables -A FORWARD -i $eth -o $wlan -j ACCEPT as here github.com/arpitjindal97/raspbian-recipes/blob/master/…
    – Rho Phi
    Nov 25 at 12:26












  • FYI raspberrypi.stackexchange.com/questions/48307/… is the cleanest Jessie/Strech-aware tutorial I found.
    – Rho Phi
    Nov 25 at 12:30




















  • Have you tried the "Turn a raspberry into a router" instructions already found elsewhere on the web?
    – grawity
    Nov 25 at 11:47










  • Thanks for chiming in. Yes, I read the manual(s). Forgot to mention that most tutorials use DHCP, and I am not. Besides there is a transition in networking from Jessie to Strech that makes more challenging to follow tutorials.
    – Rho Phi
    Nov 25 at 12:26










  • I have made some progress with iptables (still available in Jessie) sudo iptables -F; sudo iptables -t nat -F; sudo iptables -t nat -A POSTROUTING -o $wlan -j MASQUERADE; sudo iptables -A FORWARD -i $wlan -o $eth -m state --state RELATED,ESTABLISHED -j ACCEPT; sudo iptables -A FORWARD -i $eth -o $wlan -j ACCEPT as here github.com/arpitjindal97/raspbian-recipes/blob/master/…
    – Rho Phi
    Nov 25 at 12:26












  • FYI raspberrypi.stackexchange.com/questions/48307/… is the cleanest Jessie/Strech-aware tutorial I found.
    – Rho Phi
    Nov 25 at 12:30


















Have you tried the "Turn a raspberry into a router" instructions already found elsewhere on the web?
– grawity
Nov 25 at 11:47




Have you tried the "Turn a raspberry into a router" instructions already found elsewhere on the web?
– grawity
Nov 25 at 11:47












Thanks for chiming in. Yes, I read the manual(s). Forgot to mention that most tutorials use DHCP, and I am not. Besides there is a transition in networking from Jessie to Strech that makes more challenging to follow tutorials.
– Rho Phi
Nov 25 at 12:26




Thanks for chiming in. Yes, I read the manual(s). Forgot to mention that most tutorials use DHCP, and I am not. Besides there is a transition in networking from Jessie to Strech that makes more challenging to follow tutorials.
– Rho Phi
Nov 25 at 12:26












I have made some progress with iptables (still available in Jessie) sudo iptables -F; sudo iptables -t nat -F; sudo iptables -t nat -A POSTROUTING -o $wlan -j MASQUERADE; sudo iptables -A FORWARD -i $wlan -o $eth -m state --state RELATED,ESTABLISHED -j ACCEPT; sudo iptables -A FORWARD -i $eth -o $wlan -j ACCEPT as here github.com/arpitjindal97/raspbian-recipes/blob/master/…
– Rho Phi
Nov 25 at 12:26






I have made some progress with iptables (still available in Jessie) sudo iptables -F; sudo iptables -t nat -F; sudo iptables -t nat -A POSTROUTING -o $wlan -j MASQUERADE; sudo iptables -A FORWARD -i $wlan -o $eth -m state --state RELATED,ESTABLISHED -j ACCEPT; sudo iptables -A FORWARD -i $eth -o $wlan -j ACCEPT as here github.com/arpitjindal97/raspbian-recipes/blob/master/…
– Rho Phi
Nov 25 at 12:26














FYI raspberrypi.stackexchange.com/questions/48307/… is the cleanest Jessie/Strech-aware tutorial I found.
– Rho Phi
Nov 25 at 12:30






FYI raspberrypi.stackexchange.com/questions/48307/… is the cleanest Jessie/Strech-aware tutorial I found.
– Rho Phi
Nov 25 at 12:30

















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1378199%2fhow-to-make-my-raspberry-pi-act-as-gateway-for-eth0-subnet-using-eth1-internet-c%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1378199%2fhow-to-make-my-raspberry-pi-act-as-gateway-for-eth0-subnet-using-eth1-internet-c%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Plaza Victoria

Puebla de Zaragoza

Musa