LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-06-2023, 03:13 PM   #1
KyronSaif
LQ Newbie
 
Registered: Dec 2023
Posts: 2

Rep: Reputation: 0
Debian Sub-Router - LAN isn't getting an actual internet connection


I’m trying to make a very specific setup to where I’m able to block specific IPs on a machine behind my actual router, and essentially isolate all of my computers behind that sub-router, and I’ve been having trouble getting things to work for the past two days or so. All of this is more convoluted than it needs to be, and after trying to research and coming up short, I just decided to ask here.

Essentially, anything on the LAN side of the sub-router receives no internet. I can ping the sub-routers WAN IP and LAN IP from a machine on the LAN side, and I can ping the LAN IP and a machine on the LAN side from the sub-router, but anything outside of that (such as trying to go to a website on the local machine) doesn’t work (And the first time I tested this, I connected the LAN to my network switch, and tried it from my main PC, but it was having some weird issue to where it only assigned one IP over DHCP to my Server PC, and I had to set a static IP for my main PC). As far as I’m aware, I have everything configured properly, and the only two things I really think would be the issue are the networking service erroring when restarting (I’ll show what it says), or iptables being configured incorrectly. I will provide everything I can such as the output of certain commands that list what's what, along with the contents of my configuration files.


Here are some command outputs:
Code:
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 88:c9:b3:bf:30:b5 brd ff:ff:ff:ff:ff:ff
    altname enp1s0
    inet 192.168.68.60/22 brd 192.168.71.255 scope global dynamic ens1
       valid_lft 1463sec preferred_lft 1463sec
    inet6 fe80::8ac9:b3ff:febf:30b5/64 scope link 
       valid_lft forever preferred_lft forever
3: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 4c:cc:6a:1d:30:c7 brd ff:ff:ff:ff:ff:ff
    altname enp0s31f6
    inet 192.168.0.1/24 brd 192.168.1.255 scope global eno1
       valid_lft forever preferred_lft forever
    inet6 fe80::4ecc:6aff:fe1d:30c7/64 scope link 
       valid_lft forever preferred_lft forever
Code:
ip r
default via 192.168.68.1 dev ens1 
192.168.0.0/24 dev eno1 proto kernel scope link src 192.168.0.1 
192.168.68.0/22 dev ens1 proto kernel scope link src 192.168.68.60
Code:
netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.68.1    0.0.0.0         UG        0 0          0 ens1
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 eno1
192.168.68.0    0.0.0.0         255.255.252.0   U         0 0          0 ens1
Here is my interfaces config:
Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

auto ens1
iface ens1 inet dhcp

auto eno1
iface eno1 inet static
        address 192.168.0.1
        netmask 255.255.255.0
        broadcast 192.168.1.255
        gateway 192.168.86.60
Here is my iptables config:
Code:
# This config is basically 1:1 (ignoring the loopback traffic) to my friends config, except I changed the interface names and added NEW
*nat

-A POSTROUTING -o eno1 -j MASQUERADE

# Added loopback traffic during research to see if it would fix anything
-A INPUT -i lo -j ACCEPT

-A OUTPUT -o lo -j ACCEPT

-A INPUT -i ens1 -j ACCEPT

-A INPUT -i eno1 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

-A OUTPUT -j ACCEPT

COMMIT
Here is the error I get when restarting the networking service:
Code:
Defined-By: systemd
░░ Support: https://www.debian.org/support
░░ 
░░ A start job for unit networking.service has begun execution.
░░ 
░░ The job identifier is 4732.
Dec 06 14:37:56 kyron-router systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░ 
░░ An ExecStart= process belonging to unit networking.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 1.
Dec 06 14:37:56 kyron-router ifup[3954]: RTNETLINK answers: File exists
Dec 06 14:37:56 kyron-router systemd[1]: networking.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░ 
░░ The unit networking.service has entered the 'failed' state with result 'exit-code'.
Dec 06 14:37:56 kyron-router ifup[3941]: ifup: failed to bring up eno1
Dec 06 14:37:56 kyron-router systemd[1]: Failed to start Raise network interfaces.
░░ Subject: A start job for unit networking.service has failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░ 
░░ A start job for unit networking.service has finished with a failure.
░░ 
░░ The job identifier is 4732 and the job result is failed.
Here is the output of uname -a so people know what version of Debian I’m using:
Code:
Linux kyron-router 5.10.0-26-amd64 #1 SMP Debian 5.10.197-1 (2023-09-29) x86_64 GNU/Linux
 
Old 12-11-2023, 11:54 AM   #2
KyronSaif
LQ Newbie
 
Registered: Dec 2023
Posts: 2

Original Poster
Rep: Reputation: 0
I had solved the problem 2 days after I expected this to had already been posted (12/8/23), but essentially the fix was removing the gateway from my interfaces config, and switching ens1 and eno1 around, then restarting the networking service 2-3 times.

Here’s my current iptables config (this was generated with iptables-save, as I ran commands to add port forwarding) just to show it if anyone else needs assistance (It also has proper port forwarding too. Removed and added a few things for presentation purposes):

Code:
# Generated by iptables-save v1.8.7 on Sat Dec  9 18:49:51 2023
*filter
:INPUT ACCEPT [251:15407]
:FORWARD ACCEPT [62684:11053015]
:OUTPUT ACCEPT [139:9424]
COMMIT
# Completed on Sat Dec  9 18:49:51 2023
# Generated by iptables-save v1.8.7 on Sat Dec  9 18:49:51 2023
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
# Portforwarding SRB2’s port
-A PREROUTING -i ens1 -p tcp -m tcp --dport 5029 -j DNAT --to-destination 192.168.0.3
-A PREROUTING -i ens1 -p udp -m udp --dport 5029 -j DNAT --to-destination 192.168.0.3
#Switched ens1 and eno1
-A INPUT -i eno1 -j ACCEPT
-A INPUT -i ens1 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -j ACCEPT
# Masquerading on ens1 instead of eno1
-A POSTROUTING -o ens1 -j MASQUERADE
COMMIT
# Completed on Sat Dec  9 18:49:51 2023
 
  


Reply



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
[SOLVED] router and sub router keirvt Linux - Networking 7 03-27-2015 12:48 PM
Shell Script to compare folders,Sub-Folders and Sub-Sub-Folders unix_72427 Programming 8 08-08-2012 02:51 PM
Command to display /dir, /dir/sub, /dir/sub/files knockout_artist Linux - Newbie 9 10-25-2007 02:57 PM
creating sub-sub directories dominant Linux - Newbie 13 07-23-2004 05:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:31 AM.

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