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 11-09-2022, 07:59 AM   #1
rbauduin
LQ Newbie
 
Registered: Nov 2022
Posts: 2

Rep: Reputation: 0
Allow outgoing traffic only from one interface


I explain you quickly my project to start:

I have a server (debian 11) with a 4G SIM card and a router that also has a 4G SIM card. The server is temporarily present to supervise the 4G router, my idea is to connect the server in LAN to the router so that it retrieves the logs from the router and transmits them (via promtail) to another remote server.

The server should not depend on the 4G connection of the router but on its connection, how can I, via iptables, iproute I suppose, communicate only in LAN with the router and use only the 4G connection of the server to communicate with the outside?

Thanks !
 
Old 11-09-2022, 08:44 AM   #2
elgrandeperro
Member
 
Registered: Apr 2021
Posts: 415
Blog Entries: 2

Rep: Reputation: Disabled
Default route determines that. You set default to be the 4G Sim interface, and the other, if it is on the same network, should take that route because is is a direct connect and has higher precedence.
 
Old 11-09-2022, 02:11 PM   #3
rbauduin
LQ Newbie
 
Registered: Nov 2022
Posts: 2

Original Poster
Rep: Reputation: 0
Okay, thanks for the return.

I removed the gateway from the local network and this is what I have:

root@server:~# ip route
default via 80.125.158.44 dev wwan0 proto static metric 700
80.125.158.40/29 dev wwan0 proto kernel scope link src 80.125.158.43 metric 700
192.168.1.0/24 dev enp2s0 proto kernel scope link src 192.168.1.23 metric 100

If you can confirm me that everything is good?

Thank you!
 
  


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
Creating Docker network bridge to route outgoing traffic via specific interface? wkise Linux - Networking 0 11-23-2021 03:45 PM
Allow only traffic from one server to "get" files from other server Foxhound Linux - Server 11 01-11-2015 02:30 PM
[SOLVED] Allow outgoing nmap traffic in iptables yzT! Linux - Security 2 07-06-2014 05:36 PM
IPtables: Route outgoing traffic from internal host to only go a internet interface predatorz Linux - Networking 4 11-24-2010 09:05 AM
Traffic shaping (limiting outgoing bandwidth of all TCP-traffic except FTP/HTTP) ffkodd Linux - Networking 3 10-25-2008 12:09 AM

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

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