arpitjindal97 / raspbian-recipes

Raspberry networking made easy - Need Contributors
GNU General Public License v3.0
408 stars 165 forks source link

Problems when connecting and disconnecting the ethernet cable #24

Closed apersan closed 5 years ago

apersan commented 6 years ago

Hello,

I would like to use my raspberry pi to see geoblocked contents in my smart TV. My idea is to use Express VPN in order to unlock the contents.

I followed the steps in order to setup wifi-to-eth-route.sh but I have an issue. When I turn off the TV and turn in on again, the routing doesn't work again. It works all the time as long as the TV is on.

I have seen that the script wifi-to-eth-bridge.sh kind of refresh when the ethernet is available again but I didn't manage to set it up with a VPN.

Would you mind helping me?

Thanks a lot

arpitjindal97 commented 6 years ago

bridge script won't work with in your case. Routing works for this. What's the actual problem you face when you disconnect and reconnect the cable.

apersan commented 6 years ago

Thanks for your quick response!!

I am not sure about the last two. I think the TV doesn't get an IP. One thing that I tried was switching the TV for the laptop, and when I did ipconfig, I saw that the default gateway appears in blank.

Thanks a lot!

arpitjindal97 commented 6 years ago

Read the description at the top of the script. Maybe some package is missing i.e. dnsmasq. Have a look at interface names also in script. Are they same in Pi and script.

apersan commented 5 years ago

So, I have been testing, I have all the libraries.

The TV gets an IP (the second time the cable is connected) but it doesn't show default gateway (0.0.0.0) and the same for the DNS server.

The raspberry does have Internet though.

Any help would be highly appreciated!

Thanks

apersan commented 5 years ago

Issue solved.

It seems I was missing something in /etc/dhcpcd.conf

Adding this piece of code solved it:

    sudo echo -e "interface eth0
        fallback static_eth0
        static ip_address=$ETH0_IP_ADDRESS/24
        static routers=$ETH0_GATEWAY
        static domain_name_servers=$ETH0_GATEWAY" >> $PWD/rootfs/etc/dhcpcd.conf

    sudo echo -e "interface wlan0
        static ip_address=$WLAN0_IP_ADDRESS/24
        static routers=$WLAN0_GATEWAY
        static domain_name_servers=$WLAN0_GATEWAY" >> $PWD/rootfs/etc/dhcpcd.conf