Link to home
Start Free TrialLog in
Avatar of StarThunder
StarThunder

asked on

Linux Laptop connected to a router like a modem

I've included an image, in hopes all this makes sense.

I have a router/modem to AT&T, connected to a switch for a network.

sometimes AT&T goes out.  All other internet in our area would not work either, with the exception of a Cell's WIFI hotpsot.

I have a Fedora 26 Linux laptop, with wireless (wlo1) and ethernet (eno1)

I want to connect the laptop to the hotspot, have the laptop communicate with DHCP to the switch, just like it was a router. HELP!

I have installed dhcp-server on laptop. I've included an image for example.
dhcp-problem.jpg
Avatar of arnold
arnold
Flag of United States of America image

does the laptop have two network cards in order to function as a router.
Commonly to achieve what you want, you would need the setup to be


 Internet 1 aAT&t   \
                                  feeds one device <=> feeds your lan
Internet 2 wifi        /

In your case your linux bx 1 nic eth0 will be getting the feed from Internet 1 modem, eth1 will be feeding the LAN with iptables configured to NAT eth1 traffic and the wifi interface configured to connect to the hot spot, using metric rules, you can set the eth0 as preferred with wifi as secondary/failover. you would need to use tests to see whether the outside via eth0 is reachable and if not alter the preference of the wifi ....

there are several guides on configuring linux as a router. there is an open source firewall
fwbuilder, https://www.pfsense.org/...
Avatar of StarThunder
StarThunder

ASKER

I was hoping it would be easier. I'm not looking to have a rollover.

When AT&T Internet goes down, I want to disconnect the AT&T router, and plug the laptop into it, and connect the laptops wireless to the wireless hotspot.

So it would go from hotspot to wireless connection on the laptop, and from the Ethernet connection on the laptop to the switch on the network the AT&T router WAS plugged into. And have the laptop provide the internet and dhcp for the network.

I've been trying to modify dhcpd.conf, and I'm not having any luck.

the Ip address that the laptops wireless is assigned is 192.168.1.198.
The ethernet address I want to go to the network is 192.168.1.254.

I want the wireless to feed to the network through the ethernet connection.

Understand? there will not be any automatic stuff going on. it's in case of emergency for the client.
maybe you could show me what the dhcpd.conf file should look like for what I first described.

The name of the wireless port on the laptop is "wlo1", and the name for the ethernet port is "eno1"
dhcpd.conf would bind to eth0 and will allocate IPs as well as DNS records pointing to itself where you would need to have DNS server (bind, or another) configured as a caching server which each user will ..

you could configure eth0 with the same IP used one the modem.

The difficulty deals with whether you will periodically connect the laptop to the LAN as a non-router, and when issue arises, switch the laptop into a router .....
The IP on wl0 can not be on the same network as the eth0

i.e. change the LAN side of the AT&T to something like 192.168.25.0/24
this way you separate the eth0 to be on a different network versus the wl0 network and this change may resolve the issue you are currently facing with both on the same network.
I just want to supply internet and dhcp to my switch.

I can change the ip's, but could someone show me an example of what I should do as far as configuration files go...

dhcpd.conf, etc...

I don't mean to be a knothead, or rude if I sound that way, I'm just exhausted. :/
you would define the scope
192.168.25.0 255.255.255.0....

https://linux.die.net/man/5/dhcpd.conf

the eth0 IP must be static that will be part of the options setting the gateway, and name servers to the clients.

note when at&t drops, the systems on the LAN will maintain their IPs and settings which is why your laptop eth0 must use the same IP as the one the modem used prior to maintain continuity,. or the switch has to be power cycled to force the systems to re0acquire an IP....

You also need to setup DNS.... on the laptop or will you be providing the lcients with public dns, opendns, google ... etc.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.