58 votes

How to set the preferred network interface in Linux

Here's the complete answer, in case it helps others: To make packets with destinations 192.168.10.* use eth0, and all other packets use eth1: 1) View your current routing table ip route list One ...
Luke's user avatar
  • 761
47 votes
Accepted

What makes a private IP address not routable?

Private IP addresses are routable, albeit they are not publicly routed. Basically, a router will route a private address to private/internal LAN, rather than to the internet. To expand my answer: a ...
shodanshok's user avatar
  • 50.6k
36 votes

Multiple devices with one IPv6 to the Internet?

IPv6 is designed to not do that. Trying IPv4 style NAT with IPv6 will break things. That said, I'm pretty sure you can do NAT IPv6 with Linux iptables, so it's not impossible. But I would strongly ...
Sander Steffann's user avatar
34 votes

Why "Nexthop has invalid gateway" when it seems to be defined?

Perhaps something like: ip route add <gateway IP> dev <interface on which it should be reachable> and then ip route add default via <gateway ip> "Direct connection" can ...
Jamie Prince's user avatar
30 votes
Accepted

Are people really going to use public IPv6 addresses on their private networks?

Is that how IPv6 is intended to work? In short, yes. One of the primary reasons for increasing the address space so drastically with IPv6 is to get rid of band-aid technologies like NAT and make ...
Ryan Bolger's user avatar
  • 16.9k
29 votes

Adding a route to specific host go out a specific interface

On a newer machine using the ip binary the syntax to add a route is slightly different (but thankfully really consistent for hosts/networks/etc). ip route add 10.0.1.3 via 10.0.0.1 dev eth0 If you ...
dragon788's user avatar
  • 846
22 votes

How to verify a AWS VPC (S3) endpoint works?

I guess the straightfwd way is to actually probe those routes. You can traceroute to s3 and see if the NAT Gateway's internal IP is anywhere in the output (eg. the first hop). First, check the NAT ...
Valer's user avatar
  • 320
21 votes

Are people really going to use public IPv6 addresses on their private networks?

We use public IPv6 addresses in our company network for all devices. We use a stateful firewall on our gateway, that: allows all icmpv6 allows new connections from internal network out allows ...
Yarik Dot's user avatar
  • 1,583
21 votes

Multiple devices with one IPv6 to the Internet?

IPv6 doesn't have a NAT standard the way IPv4 does. There is an EXPERIMENMTAL RFC for one-to-one NAT (one outside address for each inside address) on IPv6, but explicitly forbids what you want to do (...
Ron Maupin's user avatar
  • 3,273
20 votes

OpenVPN - how to stop public traffic routing through vpn server?

The problem was caused by Network Manager which was handling the opvn config. To disable sending all traffic through the VPN do this Click NetworkManager applet icon > VPN Connections > Configure VPN....
markhorrocks's user avatar
19 votes

Can switches do VLAN routing?

L2 switches cannot do Inter-VLAN routing, since they only take care of L2 network stuff, that is, forward frames between links. If it is a L3 switch, then it can do IP protocol routing between VLANs.
Tero Kilkanen's user avatar
19 votes
Accepted

IP Routing - For Office Move

When a host tries to access another host in the same subnet, it issues an ARP request for the host MAC address. If no ARP reply is received, then the host is declared unreachable. So, therefore you ...
Tero Kilkanen's user avatar
18 votes

Difference beetween DNAT and REDIRECT in IPTABLES

REDIRECT does alter the destination IP address to send to the machine itself as answered by Warner@. But I'd say that answer is not totally correct, or a bit misleading. REDIRECT is not just for ...
Julio Diez's user avatar
18 votes
Accepted

Disabling rp_filter on one interface

Info there: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/Documentation/networking/ip-sysctl.txt?h=v4.9#n1090 Note the last sentence that would explain your attempts: ...
A.B's user avatar
  • 12.8k
17 votes
Accepted

Use ip route add to add multicast routes to multiple interfaces

That you have multicast going through your Linux box by using unicast routing is a combination of a couple of lucky circumstances. Multicast routing is not the same as unicast routing. Unicast ...
Ron Maupin's user avatar
  • 3,273
15 votes
Accepted

How to verify a AWS VPC (S3) endpoint works?

I have found a method to verify the VPC endpoint usage. Log in to an AWS EC2 instance in the VPC Configure the aws cli client run aws ec2 describe-prefix-lists; for Windows PowerShell, Get-...
M. Glatki's user avatar
  • 2,084
14 votes

Are people really going to use public IPv6 addresses on their private networks?

If there is no need for outside connectivity, then private networks can be used. That is the reason for defining private address space also in IPv6. NAT is a hack that was invented to delay IPv4 ...
Tero Kilkanen's user avatar
14 votes

Why "Nexthop has invalid gateway" when it seems to be defined?

A gateway address can only be on a directly connected network. The 10.7.0.0/24 network is not directly connected to your host 10.0.0.2, but is instead separated by another network, which is connected ...
Michael Hampton's user avatar
13 votes

How to Set Up Linux Server As A Router with NAT

I think the other answers missed some important points. Here's another way, assuming iptables is in a fresh state, once again using eth0 as the internal interface and eth1 as external: Enable IP ...
multithr3at3d's user avatar
13 votes

Why "Nexthop has invalid gateway" when it seems to be defined?

I've also encountered the problem, you need ip link set LINK_NAME up be aware that if the link has dependencies on other links, such as veth pair, you also need enable them too.
osexp2000's user avatar
  • 395
12 votes
Accepted

Set up public ip on server

Presenting a service to the Internet definitely should not be done unless you know what you're doing. Fortunately it's mostly a matter of not being naïve, but you definitely should have passed a ...
Mikael H's user avatar
  • 5,099
11 votes
Accepted

Changing OpenVPN DHCP pool

OK finally it is solved with some changes on the config file: port 1194 proto udp dev tun ca /etc/openvpn/ca.crt cert /etc/openvpn/server.crt key /etc/openvpn/server.key dh /etc/openvpn/dh2048.pem ...
Z T's user avatar
  • 279
11 votes

Is it possible to override a single domain name using dnsmasq?

Add this line to /etc/dnsmasq.conf: addn-hosts=/etc/dnsmasq.hosts Then insert your domain names into /etc/dnsmasq.hosts: 10.0.0.1 prod.example.com. 10.0.0.2 dev.example.com. Don't forget the ...
Jon Musselwhite's user avatar
11 votes
Accepted

AWS EC2 SSH from my IP address which has changed

Go with #3. It's trivial to write a small script you can run that will: Fetch your current public IP Use that IP and awscli to update your security group Stick this script on your desktop and you're ...
EEAA's user avatar
  • 110k
11 votes

How to verify a AWS VPC (S3) endpoint works?

You can turn on S3 logging and check if the files are being accessed from your private IP rather than public. If your logging shows private IPs are accessing the buckets you've configured it correctly....
Michael's user avatar
  • 111
11 votes

Can switches do VLAN routing?

VLANs are used to create different subnets which means different broadcast domains. You need to have either a router or a Layer-3 switch in order to forward traffic between different VLANs (different ...
Khaled's user avatar
  • 36.9k
11 votes

What makes a private IP address not routable?

Private IP addresses (as per RFC 1918) are very much routable, just not on the public Internet. Usually, private IP addresses are filtered by the ISP. Your access router should also be configured to ...
Zac67's user avatar
  • 11.7k
10 votes
Accepted

OpenBSD: Gateway outside subnet (works in Linux)

This is an old thread, but here goes. As it happens, I run a number of OpenBSD VMs on an ESXi 6.0 running at SoYouStart, a daughter company of OVH. The network setup there is the same as with OVH ...
mike's user avatar
  • 228
10 votes

How to enable traceroute in linux machine

We can see from man 8 traceroute that: UDP is the default traceroute mechanism on Linux traceroute expects to get an "ICMP unreachable" message in response to its query traces start at port 33434 and ...
miken32's user avatar
  • 964
10 votes

Can switches do VLAN routing?

Routing is a layer 3 function, while VLAN only concern Layer 2. When a computer A want to send data to another host B, using the IP protocol it will first check if B is in the same network as himself ...
JFL's user avatar
  • 2,028

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