Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [routing]

Routing (in IP-based networks) is the process of selecting paths in a network along which to send network traffic.

Filter by
Sorted by
Tagged with
27 votes
6 answers
94k views

Output traffic on different interfaces based on destination port

My question is basically the same as Only allow certain outbound traffic on certain interfaces. I have two interfaces eth1 (10.0.0.2) and wlan0 (192.168.0.2). My default route is for eth1. Let's say ...
rumpel's user avatar
  • 374
16 votes
2 answers
33k views

Separate Network Traffic on Two Network Interfaces

Could you lend your expertise in understanding how to go about configuring the separation of network traffic on two network interfaces? As I understand thus far, static routes are used for network ...
Christopher's user avatar
  • 15.9k
64 votes
4 answers
86k views

Bind unix program to specific network interface

Question: How do I launch a program while ensuring that its network access is bound via a specific network interface? Case: I want to access two distinct machines with the same IP (192.168.1.1), but ...
Skeen's user avatar
  • 1,031
79 votes
4 answers
106k views

Reply on same interface as incoming?

I have a system with two interfaces. Both interfaces are connected to the internet. One of them is set as the default route; a side effect of this is that if a packet comes in on the non-default-route ...
Shawn J. Goff's user avatar
100 votes
2 answers
116k views

What is kernel ip forwarding?

I have seen on many blogs, using this command to enable IP forwarding while using many network security/sniffing tools on linux echo 1 > /proc/sys/net/ipv4/ip_forward Can anyone explain me in ...
Madhur Ahuja's user avatar
  • 1,499
19 votes
2 answers
7k views

Linux Source Routing, Strong End System Model / Strong Host Model?

Can a multihomed Linux machine implement a true Strong ES Model? ###Specific Use Case I have a system with five different interfaces, each connected to the same subnet, thus the same gateway to the ...
Will's user avatar
  • 2,764
26 votes
2 answers
52k views

How can I use Linux as a Gateway?

NOTE: If client devices (computer B in this example) want to obtain internet through the gateway computer, maybe they still need to configure nameserver resolution. This is not explained here (a ...
Sopalajo de Arrierez's user avatar
11 votes
1 answer
11k views

OpenVPN Client and Server on same machine - Server doesn't allow connections when client is connected

I am new to this community and am hopeful that somebody can help me. Please let me know if I haven't posted all required information. Situation: I have a linux server (raspberry pi, 192.168.1.2) ...
khofm's user avatar
  • 261
2 votes
1 answer
6k views

Always Forward Traffic Out The Interface It Originated On

(This is the original question but my eventual solution was too different from how I originally asked the question so I'm posting as a new question.) Background: I have a VM with three different ...
Bratchley's user avatar
  • 16.9k
1 vote
1 answer
9k views

route traffic on certain port through certain interface?

I am currently running a system in which I need to be able to send and recieve HTTP and HTTPS traffic directly, however all other traffic must go via a VPN. My setup is : x2 interfaces : eth0 (...
jmaris's user avatar
  • 13
1 vote
1 answer
7k views

Routing port traffic over specific interface

I am kind of new to the whole networking thing on linux. I am running Ubuntu 20.04, linux 5.4.0-25-generic. I am trying to do the following and I am a little stuck. I have a interface: bond0, that is ...
Tomas Reyes's user avatar
18 votes
1 answer
23k views

Linux as router with multiple internet providers

Linux as router: I have 3 Internet providers, each with its own modem. Provider1, which is gateway address 192.168.1.1 Connected to linux router eth1/192.168.1.2 Provider2, gateway address 192.168.2....
Flav's user avatar
  • 183
2 votes
1 answer
4k views

Static IP address shifting to 192.168.1.251

I have a system with a static IP address of 192.168.1.150. I configured /etc/network/interfaces manually (i.e. without using NetworkManager.) It is a web server hosting three sites. I am having ...
nanci's user avatar
  • 41
1 vote
1 answer
4k views

How can I use ISC KEA DHCP (DHCPv4) server to push routes to clients?

QUESTION: I have an infrastructure with 5 servers (Server #1, #2, #3, #4 and #5). I am trying to use a server (Server #5) with ISC KEA DHCP (DHCPv4) ( https://kea.isc.org/wiki ) to push routes to ...
Eduardo Lucio's user avatar
49 votes
3 answers
161k views

Use ssh with a specific network interface

I'm using openconnect to connect to vpn. After entering my credentials, I get this: POST https://domain.name/... Got CONNECT response: HTTP/1.1 200 OK CSTP connected. DPD 30, Keepalive 30 Connected ...
axel22's user avatar
  • 664
31 votes
2 answers
44k views

Tools for Debugging Routing Tables on a Linux Machine?

Is there a tool that debugs routing tables on a Linux machine? I mean one that I can use by inputting an ip address into it, it'll take the existing routing table into account and output the ...
leeand00's user avatar
  • 4,625
27 votes
7 answers
285k views

How can I change the default gateway?

Currently I'm running a FreeBSD 9.1 and the default gateway is already configured in the rc.conf. rc.conf: defaultrouter = "10.0.0.1" But now I want to change the default gateway without rebooting ...
WWW's user avatar
  • 373
27 votes
4 answers
188k views

Modifying existing route entry in linux

what is the command to modify metric of an existing route entry in linux? I am able to change gateway of an existing entry using "ip route change" command as below but not able to change metrics. Is ...
user1762571's user avatar
24 votes
6 answers
88k views

How can I make changes to the network routing metric permanently

I'm able change my network routing metrics with ifmetric, for example ifmetric enp0s3 1. Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 ...
marathon's user avatar
  • 943
18 votes
2 answers
68k views

iptables --set-mark - Route diferent ports through different interfaces

Short story, 3 interfaces, eth0 (LAN), eth1(ADSL), eth2(4G). eth0 -> eth1: Works (ports 80, 443, 4070) eth0 -> eth2: Doesn't happen This is a graphical representation of the idea: Port 80 & 443 ...
11 votes
1 answer
91k views

Adding two default gateways in Debian interfaces file

This is my interfaces file: auto eth0 iface eth0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1 auto eth1 iface eth1 inet static address 192.168.2.10 ...
nixnotwin's user avatar
  • 838
10 votes
4 answers
25k views

NetworkManager changes default routing policy

I have a machine with a built-in NIC (eth0), which serves as a DHCP server for a Raspberry Pi. I also have a USB 3G modem, which shows up as ethernet device eth1. eth0 has the static ip 192.168.100.1 ...
appas's user avatar
  • 211
9 votes
1 answer
9k views

Network interface preference

How does Linux determine which network interface to use, when both are connected to the same network? Note that this isn't a question on routing. I'm familiar with how that works. This is if, say, I ...
Dominick Pastore's user avatar
9 votes
1 answer
4k views

Dual network connection

I have a usb cellular modem and a Home LAN connection on my Ubuntu 10.10 box. Both work independently. I want to know how to have both connected at the same time, and be able to specify which ...
Justin Alexander's user avatar
7 votes
7 answers
42k views

Make nslookup use specific interface

On my computer I have two network cards. Both are using different Internet Providers service. Both Internet service provider have different DNS server and their IP address are known to me. I want to ...
Rahul Gautam's user avatar
6 votes
1 answer
4k views

multigateway routing for specific src port

I have two gateway to access internet, somehow I want to load balancing it, so far its working, but some connection or service need persistent gateway IP to be used, so the client should never change ...
uray's user avatar
  • 3,890
6 votes
3 answers
3k views

Redirect traffic through vpn on an as needed basis

My problem is really simple yet it sounds complex, but I have zero to none experience with this. I have set up a box using gentoo which has its own semi-static WAN-IP and acts as router for my LAN. I ...
Baarn's user avatar
  • 882
5 votes
2 answers
8k views

Routing for multiple uplinks/providers

I have a PC with two internet connections. The first one is an Ethernet interface to connect to my local network and access internet via my router. The second one use a GSM modem to connect with ppp. ...
slepasteur's user avatar
5 votes
1 answer
14k views

How do I route traffic through specific interface for a specific process

I have a script that runs from cron every 15 minutes. The script is meant to ping my DNS server to update a dynamically changing IP. I want this script to ping through the wlan interface and not the ...
Lord Loh.'s user avatar
  • 1,986
4 votes
1 answer
1k views

How to gather full network usage statistics on a freebsd router?

I have a freebsd box, which serves as a router from LAN to the outside world. It has several Internet providers, OpenVPN servers and clients, NAT and so on. I would like to have complete statistics ...
Dims's user avatar
  • 3,255
4 votes
3 answers
7k views

Send duplicate packets over two Internet connections

I need to duplicate an RTP stream over two different (non-reliable) Internet connections. On the receiver side, I will probably run a custom program that will use a buffer and rebuild the stream ...
Andrea Spadaccini's user avatar
4 votes
3 answers
10k views

How does Linux choose between multiple default gateways?

I have a computer with two NICS, one eth one wlan. wlan is on 10.0.0.0/24 eth is on 192.168.0.0/16 Kernel routing table is: $ route -n Kernel IP routing table Destination Gateway ...
lash's user avatar
  • 729
4 votes
2 answers
2k views

How to set preferred IPv6 interface

I have a program that sends multicast traffic via IPv6. It sends traffic out of the default network interface. It works fine normally (traffic goes out eth0) however if I have Docker loaded, then it ...
Malvineous's user avatar
  • 6,923
3 votes
1 answer
4k views

Routing traffic for a user through specific interface (tum1)

Question: How do I route traffic though tun1 for a specific user? What I've tried so far: I followed: 1: iptables forward all traffic to interface sudo iptables -t nat -A POSTROUTING -m owner --uid-...
james's user avatar
  • 133
3 votes
1 answer
12k views

Only routing certain traffic through VPN

I have a central development server, running a VPN server, and a couple clients that need to connect to it. The server is running Apache, but is only accepting local requests (only listening on 127.0....
nopcorn's user avatar
  • 9,609
2 votes
0 answers
5k views

Mark a packets with iptables in order to make a source ip routing

I have a linux machine, which I use as a gateway and firewall. The linux machine (GW/FIREWALL) is connected to a device which allow internet connection (Router Aggregator), it has 2 IP addresses 172....
famedoro's user avatar
  • 145
2 votes
1 answer
2k views

Connect through different interfaces to the same server (SO_BINDTODEVICE): Destination Host Unreachable

I have 2 interfaces: eth0 and wlan0, each one connected to a different router. Their network specs are these: eth0: ip: 192.168.1.7 Gateway: 192.168.1.1 Submask: 255.255.255.0 wlan0: ...
Jorge Fuentes González's user avatar
2 votes
1 answer
792 views

OpenBSD with only a /32 repeatedly deletes its static route to the world

I have OpenBSD 5.9 on a virtual private server. Like other people in these days of No More IPv4 Address Space For You, the machine is allocated only a /32, i.e. a LAN of just a single IPv4 address. ...
JdeBP's user avatar
  • 69.2k
1 vote
1 answer
2k views

How do I forward all packets from wlan0 to tun0 (OpenVPN)?

I have wlan0 and eth0. Eth0 is connected to the internet and wlan0 is an access point. I connected to an OpenVPN server with the "--pull-filter ignore redirect-gateway" option so that it ...
Alsan Ali's user avatar
1 vote
1 answer
75 views

How exactly does Linux use the prefix length assigned to network interface?

I assigned IP address 192.168.0.1/24 to eth0 in two ways. A. Adding 192.168.0.1/24 as usual # ip addr add 192.168.0.1/24 dev eth0 # ping -c 1 192.168.0.2 PING 192.168.0.2 (192.168.0.2) 56(84) bytes of ...
Akash Rawal's user avatar
1 vote
1 answer
768 views

Iptable forward interfaces for gateway machine

I have two Ethernet interface being configured to use as system gateway ex: eth1: 10.10.1.0 eth2: 10.10.2.0 I want to forward all the packets which are coming to the 10.10.2.0 gateway contacting 10....
Kratos's user avatar
  • 381
1 vote
2 answers
2k views

Debian 9; setting network devices for an www server

I'm trying to set up apache2 server on Debian 9. I'm using an laptop with Ralink network-card, witch was able to use eth0, at Debian 8, with looks more familiar for me. Since I update my system to 9 ...
siery's user avatar
  • 209
0 votes
0 answers
110 views

Can't access device behind Double NAT LAN

I've got a few devices on my LAN running different Linux distros: Ubuntu 20.04 CentOS 7 Fedora 33 They're all in the same subnet 192.168.50.0/24. Network map: Until recently, from my PC (192.168....
denormalizer's user avatar
108 votes
12 answers
172k views

How to find out which interface am I using for connecting to the internet?

I have eth0 and wlan0 according to ifconfig and I can ping google.com. How can I find out (with a normal user, not root) what interface is active, as in, what interface did the ping (or whatever, ...
LanceBaynes's user avatar
  • 40.4k
48 votes
3 answers
66k views

How to refuse routes that are PUSHed by OpenVPN server?

When I establish an OpenVPN client connection over the Internet to our corporate OpenVPN server, it pushes several static routes. Unfortunately, these routes break some connectivity within my local ...
mbaitoff's user avatar
  • 5,121
26 votes
1 answer
190k views

OpenVPN: Push a route to client with a different gateway

I would like my OpenVPN server to push a route down to the client with a different default gateway. Specifically, my OpenVPN server has an internal IP address of 10.0.0.1, and I would like it to ...
Lorin Hochstein's user avatar
24 votes
3 answers
25k views

OpenConnect: Setting default routes

I'm trying to use OpenConnect to connect to my company's Cisco VPN (AnyConnect) The connection seems to work just fine, what I'm not understanding is how to set up routing. I'm doing this from the ...
Aditya K's user avatar
  • 2,090
18 votes
8 answers
86k views

Can I prevent a default route being added when bringing up an interface?

I have a system with two NICs on it. This machine, and a few accompanying devices will be moved and attached to different LANs or sometimes it'll be using dial-up. eth0: - 10.x.x.x address ...
Tango's user avatar
  • 353
17 votes
3 answers
63k views

In Linux, what metric has a route with no metric?

If you have (in Linux) these two routes: default via 192.168.1.1 dev enp58s0f1 default via 192.168.16.1 dev wlp59s0 proto static metric 600 I would expect that the first one is used, but that's ...
rsuarez's user avatar
  • 912
15 votes
1 answer
14k views

how to understand the routing table on an OpenVPN client

I just setup the OpenVPN and it is working as expected. However, the routing table of the client is confusing me to no end. Here is the route table: # route -n Kernel IP routing table Destination ...
slayedbylucifer's user avatar