LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-18-2023, 01:18 AM   #1
THawk254
LQ Newbie
 
Registered: Dec 2016
Location: Manila, Philippines
Distribution: Ubuntu
Posts: 16

Rep: Reputation: Disabled
Routing Issue between 2 interfaces with netplan in Ubuntu 22.04


I'm trying to build an edge firewall using Ubuntu Server 22.04. The box has 2 physical interfaces but for some reason I can't seem to get anything on the public facing interface:

Internal: 192.168.20.137/24 with no default gw.
External: 1.1.1.140/29 with gw of 1.1.1.137

I can't seem to get traffic to flow through the public interface.

EDIT: IP Forwarding is on.

If I need to update the machine, I use the old gateway but obviously that's not a solution...

Contents of the yaml file below:

Code:
network:
  version: 2
  renderer: networkd
  ethernets:
    enp4s0:
      addresses: [192.168.20.137/24]
        #routes:
        #- to: 0.0.0.0/0
        #  via: 192.168.20.197
      nameservers:
        addresses: [192.168.20.192,192.168.20.182]
    enp3s0:
      addresses: [1.1.1.140/29]
      routes:
      - to: 0.0.0.0/0
        via: 1.1.1.137
      nameservers:
        addresses:
        - 8.8.8.8
Code:
root@severussnape:/etc/netplan# ip r s
default via 1.1.1.137 dev enp3s0 proto static 
192.168.20.0/24 dev enp4s0 proto kernel scope link src 192.168.20.137 
1.1.1.1/29 dev enp3s0 proto kernel scope link src 1.1.1.140
Code:
root@severussnape:/etc/netplan# ip a s
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: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 10:62:eb:34:5a:89 brd ff:ff:ff:ff:ff:ff
    inet 1.1.1.140/29 brd 210.4.125.143 scope global enp3s0
       valid_lft forever preferred_lft forever
    inet6 fe80::1262:ebff:fe34:5a89/64 scope link 
       valid_lft forever preferred_lft forever
3: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 04:d4:c4:53:c0:96 brd ff:ff:ff:ff:ff:ff
    inet 192.168.20.137/24 brd 192.168.20.255 scope global enp4s0
       valid_lft forever preferred_lft forever
    inet6 fe80::6d4:c4ff:fe53:c096/64 scope link 
       valid_lft forever preferred_lft forever

Last edited by THawk254; 10-18-2023 at 01:20 AM. Reason: added note that ip forwarding is on...
 
Old 10-19-2023, 01:05 AM   #2
Person_1873
Member
 
Registered: Sep 2007
Location: Australia
Distribution: Gentoo / Debian / Rasbian / Proxmox
Posts: 519

Rep: Reputation: 44
I've never used netplan, but i've set up linux routers using iptables.
It used to be that you needed to enable masquerading so that the router could perform Network Address Translation (NAT)
I would assume that there is some parallel here.

I've done a little bit of googling and found this. hopefully this is helpful
https://unix.stackexchange.com/quest...eate-a-gateway
 
Old 10-29-2023, 01:04 PM   #3
elgrandeperro
Member
 
Registered: Apr 2021
Posts: 415
Blog Entries: 2

Rep: Reputation: Disabled
You probably get to the default gateway, you probably can ping it. ISPs will not route private IP space, they will drop it. So if you look at netstat or equivalent, you probably are forwarding but it is being dropped. OH that is why you need to masquerade/NAT it.

Last edited by elgrandeperro; 10-29-2023 at 01:25 PM.
 
Old 10-30-2023, 08:57 AM   #4
pingu_penguin
Member
 
Registered: Aug 2004
Location: pune
Distribution: Slackware
Posts: 351

Rep: Reputation: 60
Have you tried pinging a site from your internet-facing interface ?

What is the output of :

# ping -I enp3s0 google.com

How are you forwarding ? iptables ? or kernel settings based routing ?


Should things not work for you with ping. Try adding a route to your enp3s0 (your public interface) :

# route add -net 0.0.0.0 netmask 0.0.0.0 dev enp3s0

Then try ping and let us know.
 
  


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] ip - ifconfig - netplan - interfaces file banderas20 Linux - Networking 4 09-20-2023 10:42 AM
routing using netplan curious877 Linux - Newbie 0 10-06-2022 12:45 AM
NETPLAN — static route between interfaces, separate subnets --ubuntu 18.04 jazzmice Linux - Networking 8 11-01-2020 06:33 PM
Ubuntu 17.04, netplan, bring up interface without ip da1 Ubuntu 3 01-24-2018 10:04 AM

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

All times are GMT -5. The time now is 09:17 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