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

Is it possible to have multiple default gateways for outbound connections?

Solved it myself. There seems to be very little information about the networking stuff that you can do with Linux, so I have decided to document and explain my solution in detail. This is my final ...
rosix's user avatar
  • 1,043
33 votes

How to understand (the output of) ifconfig or ip addr show

Here are the parts that I can already parse, for reference for anyone else with the same question. eth0 is the interface name. It can be any string: mtu 1500 maximum transmission unit = 1500 bytes, ...
Ari Sweedler's user avatar
21 votes

Is it possible to have multiple default gateways for outbound connections?

Linux provides a better solution than your scripted workaround: active-backup bonding. This way your machine will have only one ip address (and one mac address) and automatically and transparently ...
Thilo's user avatar
  • 319
12 votes

Namespace management with ip netns (iproute2)

You have two questions in one: what are the empty files in /var/run/netns/? how to use /etc/netns/ which doesn't even exist? What are the empty files in /var/run/netns/? Some understanding of ...
A.B's user avatar
  • 37k
11 votes

ip route add fails with next hop invalid although next hop on directly connected network

you have to use "onlink" too, like so: ip r a 10.0.0.0/24 via 194.104.212.225 dev eth0 onlink because the net 10.0.0.0/24 and default gw are outside of all known local networks. you ...
StefanKaerst's user avatar
11 votes
Accepted

The difference between ip link down and physical link absence

There are difference between an interface which is administratively up but disconnected or administratively down. Disconnected The interface gets a carrier down status. Its proper handling might ...
A.B's user avatar
  • 37k
10 votes
Accepted

List *all* IP routes to a destination in the Linux routing table

There is an easy way to list all routes matchig prefix on linux : ip -6 route list match 2607:f8b0:4005:804::200e table all This will list all possible routes to specified target (including default, ...
aldem's user avatar
  • 116
10 votes

Pretty display of "ip route"

Answering my own question a few years later... I just learned that a pretty display with colors was added in Feb 2018. This makes the output more readable to me: From man ip: -c[color][={always|...
Gohu's user avatar
  • 2,094
10 votes

Pretty display of "ip route"

The iproute2 package (Debian, Ubuntu) and the iproute package (CentOS, RedHat) both include a utility specifically designed for this: routel, list routes with pretty output format. Sample of output: [...
chb's user avatar
  • 634
10 votes
Accepted

Where is the official documentation (Debian package iproute-doc)?

The documentation is available in the Debian 9 package but was removed in later releases because it was outdated. The manpage is supposed to be the complete documentation now. (But it doesn’t have ...
Stephen Kitt's user avatar
10 votes
Accepted

iproute2: How to display the TYPE of a network devices?

The interface type information, being rarely used, is normally displayed only by adding the -details option to ip: -d, -details     Output more detailed information. So ip -details link show would ...
A.B's user avatar
  • 37k
9 votes

How can I create a virtual ethernet interface on a machine without a physical adapter?

Adding virtual (dummy) interface devices on Linux ...and an introduction to the ip address command and adding or deleting IP addresses and netmasks. Tested on Ubuntu 18.04 and 22.04. Quick summary ...
Gabriel Staples's user avatar
9 votes
Accepted

Interface both up and down?

Within the angle brackets there is a list of flags (= on/off type properties) of the interface. After the flags, non-binary properties (also known as attributes) are listed. There are two concepts you ...
telcoM's user avatar
  • 98.1k
8 votes
Accepted

Connecting two network namespaces via a veth interface pair where each endpoint has the same name

The best that I can offer is to execute the command in one namespace (using the -n shortcut), create each endpoint with the same name, and move one of them into a different namespace in that command: ...
dirkt's user avatar
  • 32.5k
8 votes

What exactly does these ip lines do?

I know this question is kind of old, but I just spent hours piecing this together, so in case it helps others who find their way here, I'll take a stab at a not-too-technical answer. There are a few ...
Askeli's user avatar
  • 193
7 votes
Accepted

default route with linkdown

In new kernel we have new defaults. Solution is echo 1 > /proc/sys/net/ipv4/conf/enp0s10/ignore_routes_with_linkdown echo 1 > /proc/sys/net/ipv4/conf/enp0s18/ignore_routes_with_linkdown And ...
eri's user avatar
  • 905
7 votes
Accepted

How do I find all interfaces that have been configured in Linux, including those of containers?

An interface, at a given time, belongs to one network namespace and only one. The init (initial) network namespace, except for inheriting physical interfaces of destroyed network namespaces has no ...
A.B's user avatar
  • 37k
7 votes
Accepted

How can I get the ipv4 address from `ip link` like I used to see with ifconfig?

Apparently ip broke up the MAC address (now in the ip link (device) interface), and the network ip address. The command ip address is what shows the network addresses, 1: lo: <LOOPBACK,UP,LOWER_UP&...
Evan Carroll's user avatar
  • 31.3k
6 votes

How can I bridge two interfaces with ip/iproute2?

The equivalent of brctl show is bridge link. You can show the bridge status per device with bridge link show dev eth0 but bridge looks at the network interface and tells you which bridge it belongs to ...
Dominik Heidler's user avatar
6 votes
Accepted

Where is this IPv6 address coming from?

After some experimentation I found the following command can be used: ip monitor It will display a list of what's happening. Run it in one terminal, restart the network interface in another, and ...
Malvineous's user avatar
  • 6,923
6 votes
Accepted

Is there a way to save current state of network configuration in linux into a datafile or set of ip commands like iptables-save?

Some support does exist for saving addresses, routes and rules, using iproute2's ip command. For obvious reason, this doesn't exist for links, even if one could imagine the possibility to save some ...
A.B's user avatar
  • 37k
6 votes
Accepted

How to utilize Windows 10 Connection Sharing to Access ZScaler protected Websites on Linux / Ubuntu 18.04

My company decided to drop our VPN for ZScaler and being the only person running Linux at my company I was left behind because ZScaler doesn't have a native Linux client. Let me start by saying that ...
fIwJlxSzApHEZIl's user avatar
6 votes
Accepted

Problem when resetting the default-gw at flushed routing-table

On Linux, by default (when an address is not added with the flag noprefixroute), adding an address to an interface implicitly adds a route to the LAN with scope link. You have a route to your gateway ...
A.B's user avatar
  • 37k
6 votes
Accepted

Get which /dev/tapX got associated to a macvtap without guessing

The device name is created based upon the interface index: snprintf(tap_name, IFNAMSIZ, "tap%d", dev->ifindex); [...] devt = MKDEV(MAJOR(macvtap_major), vlantap->tap.minor); ...
A.B's user avatar
  • 37k
6 votes

iptables -p with protocols other than tcp/udp

iptables supports filtering at the datalink, network and transport layers. The -p (protocol) option is not specifically limited to layer 4 protocols. The man page mentions icmp and esp specifically. I ...
111---'s user avatar
  • 4,546
5 votes
Accepted

Pretty display of "ip route"

This awk script assumes, perhaps wrongly, that the output values are in pairs of keyword value, e.g. scope link, with some exceptions like the first column, and the linkdown keyword. It accumulates ...
meuh's user avatar
  • 51.7k
5 votes

What exactly does these ip lines do?

For ip rule add table 128 from 192.168.10.123: The ip rule manipulates routing rules. It takes both a SELECTOR and an ACTION. So in this case the SELECTOR is from 192.168.10.123 ( 192.168.10.123 is ...
Jaken551's user avatar
  • 575
5 votes
Accepted

How to delete ip route by URL?

The entry google.com is not a URL; it's a domain name, or possibly a host name. (It could be part of a URL, though.) If you use netstat -rn you will get IP addresses instead of names in that first ...
Chris Davies's user avatar
5 votes
Accepted

How to understand (the output of) ifconfig or ip addr show

Addresses with global scope are global from the point of view of the host, i.e. they are not restricted to the host or the local link. The host does not care, and does nothing different, in the case ...
Johan Myréen's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible