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 ...
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, ...
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 ...
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 ...
11
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|...
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 ...
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 ...
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, ...
10
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
...
10
votes
Accepted
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:
[...
10
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 ...
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 ...
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 ...
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:
...
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 ...
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 ...
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 ...
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&...
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 ...
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 ...
6
votes
what does the wildcard expression mean in command ss?
Let's start with Address columns:
0.0.0.0 is not a wildcard for any ip address. It is a wildcard for any ipv4 address.
[::] is a wildcard for any ipv6 address.
* is a wildcard for any ip address (...
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 ...
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 ...
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 ...
6
votes
Accepted
`ip route add` does not allow duplicate entries, can I depend on that?
You can use ip route replace instead of add.
This takes the same parameters as add but does not fail, when the route currently exists.
As man ip-route tells us
ip route replace
change or ...
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);
...
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 ...
5
votes
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
iproute × 304networking × 116
linux × 78
routing × 72
iptables × 47
route × 36
ip × 35
network-interface × 33
vpn × 16
ipv6 × 13
bridge × 13
debian × 11
openvpn × 11
tunneling × 11
ubuntu × 10
centos × 10
linux-kernel × 8
networkmanager × 8
network-namespaces × 8
wireguard × 8
docker × 7
nat × 7
gateway × 7
rhel × 6
ifconfig × 6