LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-21-2017, 03:30 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,555

Rep: Reputation: 177Reputation: 177
Need to temporarily use host spot for LAN routing


I have an ASUS router connected to my ISP's (Spectrum) cable modem. I currently have a cable outage. I would like to set up my LAN to use my 4G hotspot.
On the computer with the wireless adapter, ALPHA, I have in /etc/rc.d/rc.inet1.conf:
Code:
# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"

IFNAME[4]="wlan0"
IPADDR[4]=""
NETMASK[4]=""
USE_DHCP[4]="yes"
and on another computer, BETA, on the LAN, no wireless, I have:
Code:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"
If both eth0 and wlan0 are enabled on ALPHA I can get to BETA, but not to the Internet. If I have eth0 disabled on ALPHA I can get to the Internet, but not to BETA. I need both. I've tried adding the following to ALPHA:
Code:
iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT
But that didn't work. Maybe I specified it wrongly.

The ASUS has been the DHCP server for the wired devices giving 192.168.0.17 to ALPHA:eth0 and 192.168.0.15 to BETA:eth0. The hotspot gives 192.168.43.82 to ALPHA:wlan0.

I can get to ALPHA on 192.168.0.17 from BETA, but not to ALPHA 192.43.82 from BETA. I cannot get to the Internet from BETA

I want ALPHA:wlan0 to be my LAN network Internet gateway for all hosts on the LAN. All LAN hosts have wired connections, so they could use their eth0 interfaces to talk to each other. Whether the wired interfaces should use the ASUS for DHCP serving I don't know.

So, what do I need to do to get BETA to talk to the Internet and have ALPHA able to talk to both BETA *and* the Internet?

Last edited by mfoley; 10-21-2017 at 03:41 PM.
 
Old 10-21-2017, 04:52 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,701

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
In addition to what you posted you also need
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
 
Old 10-21-2017, 11:14 PM   #3
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,555

Original Poster
Rep: Reputation: 177Reputation: 177
Did that. Didn't post it.
Code:
# cat /proc/sys/net/ipv4/ip_forward
1
So, you think it should work as is? It's not. Should I hard-code the IP addresses for the wire interfaces and not use DHCP? If I do give ALPHA:eth0 a static address, I can connect to the Internet. I'll experiment with other hosts on the LAN.

Last edited by mfoley; 10-21-2017 at 11:20 PM.
 
Old 10-22-2017, 05:02 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,701

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
I forgot about DHCP. DHCP would provide the gateway address which is being provided by the ASUS.

Hard coding the IP addresses or setting up a DHCP server on ALPHA should work.
 
Old 10-22-2017, 12:16 PM   #5
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,555

Original Poster
Rep: Reputation: 177Reputation: 177
I'd really like to get this sorted out as I need this concept for the office when, occasionally, we lose the fiber-optic service. Here's my setup:
Code:
ALPHA:eth0 - IP: 192.168.43.14, NM: 255.255.0.0, GW: 192.168.43.1 ---+
                                                                  [switch]
BETA:eth0 -  IP: 192.168.43.17, NM: 255.255.0.0, GW: 192.168.43.1 ---+

ALPHA:wlan0 - IP:192.168.43.18, NM: 255.255.0.0, GW: 192.168.43.1 -- wireless

HotSpot - IP: 192.168.43.1
The eth0 devices are set as static, no DHCP, rc.inet1:
Code:
IPADDR[0]="192.168.43.14"
NETMASK[0]="255.255.0.0"
GATEWAY="192.168.43.1"
I do have forwarding set on ALPHA:
Code:
iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT
ALPHA is the computer with the wireless adapter and gets its IP via DHCP from the HotSpot. The eth0's are wired connections on the LAN. Simply, what I want, is for LAN communication to route via the wired connections and Internet traffic to route via the ALPHA:wlan0 interface.

As I've got this configured, it doesn't work. I have to stop the ALPHA:eth0 device (leaving only wlan0 connected) or I cannot get to the Internet. I can't get to the Internet at all from BETA via the wired connection. I know I have something set wrong.

Should I specify the gateway on BETA as ALPHA:eth0 instead of the hotspot? Do I need a bridge specified?

I know this is doable, but how?
 
Old 10-22-2017, 12:50 PM   #6
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
What does the command
Code:
/sbin/route -n
tell you?
 
Old 10-22-2017, 01:27 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,701

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Wlan0 and eth0 can not be on the same subnet. Keep it as 192.168.0.x
 
Old 10-23-2017, 09:47 PM   #8
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,555

Original Poster
Rep: Reputation: 177Reputation: 177
Quote:
Originally Posted by michaelk View Post
Wlan0 and eth0 can not be on the same subnet. Keep it as 192.168.0.x
Not sure I get what you're saying. wlan0 and eth0 were on different subnets: 192.168.43.0/24 for wlan0 and 192.168.0.0/24 for eth0. What are you saying I should keep as 192.168.0.x?

Richard Cranium: I had to reset things back to using the ISP stuff in order to get work done. So my experimentation with this may be spotty going forward, but it is something I need to sort out, so I'll continue pursuing it.
 
Old 10-23-2017, 10:10 PM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,701

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Well you did post...

Quote:
The hotspot gives 192.168.43.82 to ALPHA:wlan0.
Quote:
The eth0 devices are set as static, no DHCP, rc.inet1:
IPADDR[0]="192.168.43.14"
NETMASK[0]="255.255.0.0"
GATEWAY="192.168.43.1"
Your basically trying to configure ALPHA as a NAT device. It should be relatively simple. The IP tables rules and IP forwarding as posted. The clients need an IP address, gateway and DNS name server info verify the route is correct.
 
Old 10-23-2017, 10:54 PM   #10
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
Originally Posted by mfoley View Post
I had to reset things back to using the ISP stuff in order to get work done. So my experimentation with this may be spotty going forward, but it is something I need to sort out, so I'll continue pursuing it.
That's cool. Needs must when the devil drives.
 
Old 10-24-2017, 12:07 AM   #11
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,555

Original Poster
Rep: Reputation: 177Reputation: 177
Quote:
Originally Posted by michaelk View Post
Well you did post...
Code:
The hotspot gives 192.168.43.82 to ALPHA:wlan0.
Code:
The eth0 devices are set as static, no DHCP, rc.inet1:
IPADDR[0]="192.168.43.14"
NETMASK[0]="255.255.0.0"
GATEWAY="192.168.43.1"
Yes, you're right. I've tried various combinations and lost track of that.
Quote:
Your basically trying to configure ALPHA as a NAT device. It should be relatively simple. The IP tables rules and IP forwarding as posted. The clients need an IP address, gateway and DNS name server info verify the route is correct.
So, I'm missing the "simple" bit, and I agree, it should be. What am I missing? I'll try this again soon if I get some ideas.

If I keep the eth0 (wired) devices on the various machines as static (BETA):
Code:
IPADDR[0]="192.168.0.15"
NETMASK[0]="255.255.0.0"
and let the wlan0 on ALPHA get its IP from the hotspot (which will be 192.168.43.82); AND I have:
Code:
iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT
... set on ALPHA, what else do I need? What should the GATEWAY be specified as on BETA? Should I use ALPHA's eth0 (which would be 192.168.0.17), or ALPHA's wlan0 address? What should be in BETA's resolv.conf? I believe I've tried multiple combinations of these things, but I've certainly confused myself by now.
 
Old 10-24-2017, 05:20 AM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,701

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
BETA's gateway should be the IP address of ALPHA's eth0. The resolv.conf can be any valid DNS nameserver i.e. as provided by your ISP or a public DNS like Google (8.8.8.8 or 8.8.4.4). Also make sure you have a good routing table i.e. look at the output of the route command.
 
Old 10-24-2017, 12:04 PM   #13
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,555

Original Poster
Rep: Reputation: 177Reputation: 177
Quote:
Originally Posted by michaelk View Post
BETA's gateway should be the IP address of ALPHA's eth0. The resolv.conf can be any valid DNS nameserver i.e. as provided by your ISP or a public DNS like Google (8.8.8.8 or 8.8.4.4). Also make sure you have a good routing table i.e. look at the output of the route command.
Thanks - that IP for BETA's gateway should help. I'll try this shorty. About the nameserver, yes I could use a public nameserver like 8.8.8.8, but I'd like to use the ISP name server. Of course, I can't use my wired ISP's nameserver since this is a backup for when the wired system is down. The hotspot's IP is 192.168.43.1. Could I use that for a nameserver? If so, will that work in BETA's resolv.conf if its IP is 192.168.0.15? Should I rather use ALPHA's 192.168.0.17 IP as the nameserver?
 
Old 10-24-2017, 12:34 PM   #14
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,701

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Try using your hotspot's IP address as the name server.
 
  


Reply

Tags
gateway, router, wireless



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HowTo host W-LAN AP on dual-lan-server? --- Debian and hostapd hakalulu Linux - Wireless Networking 3 07-30-2015 12:58 PM
macvlan on host, macvtap guest, routing via host gives error nikunjmaster Linux - Virtualization and Cloud 0 01-01-2014 06:44 PM
Routing between host and vmware host-only network astbis Linux - Networking 2 12-27-2007 08:21 PM
Problem routing email from LAN host using Exim 4.43-1 neiljt Linux - Server 0 03-11-2007 09:42 AM
Routing LAN -> WAN -> LAN with unhelpful router synx13 Linux - Networking 2 06-14-2004 02:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration