57
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 ...
21
votes
Accepted
Specify route to an interface in Windows cmd
To specify the interface in windows route command, you are supposed to use 'IF'... Uppercase letters, not lowercase.
Also, where you are specifying you want to add a route to a single IP 192.168.0.6, ...
11
votes
Specify route to an interface in Windows cmd
This should work:
route add 192.168.0.6 mask 255.255.255.0 192.168.0.254
If you want persistence:
route -p add 192.168.0.6 mask 255.255.255.0 192.168.0.254
Not sure what the "if" was for, ...
9
votes
How can I configure openvpn server without push default gateway?
Due to I have ipv4 and ipv6, if I don't want openvpn to set my default gw, I had to add the following lines at my client configuration, and I had to add manually the ipv6 routes:
pull-filter ignore &...
9
votes
Accepted
What is the local routing table used for?
First of all as some available on internet info explains "The local table is a special routing table maintained by the kernel".
If you feeling really brave today you can even get some bits of ...
7
votes
Allow Docker containers to use IPSEC VPN on host
I wrote a python program to wrap ipsec that installs iptables entries to allow docker containers to talk to the VPN tunnel:
https://github.com/cbrichford/docker-ipsec
Instead of doing:
ipsec up
You ...
6
votes
Accepted
Making changes to default IPv6 route persistent in CentOS 7
When Red Hat's networking scripts set multiple IPv6 addresses configured in /etc/sysconfig/network-scripts/ifcfg-*, for whatever reason, they are applied in reverse order, so that the last address ...
6
votes
How can I configure openvpn server without push default gateway?
route-nopull in the .ovpn file, or --route-nopull on the command line.
You'll then have to set up the routes yourself, of course.
6
votes
Add IP Routes and Rules at Startup
Put your commands in a shell script e.g. /usr/local/sbin/myrouting and make it executable.
You could use cron and an @reboot target in /etc/crontab or the root crontab e.g. /etc/crontab
@reboot root ...
5
votes
Accepted
Traceroute and BGP peering
Yes, it's possible if there was tunneling involved and the two end points are in different networks. You won't see the hops between the two tunnel endpoints then, just the end points itself. It's not ...
5
votes
Accepted
ip rule and route doesn't get respected
Your issue isn't issue. In rule you use not only source address, but also input interface match. So, there are two ways to solve your "problem":
Don't use the dev eth0 in the rule
Add iif eth0 in the ...
5
votes
Accepted
Ubuntu, two NICs but only one with internet connection
As pointed out in the above comments you have two default routes (via 192.168.1.1 and 10.0.0.1) but only the first one connects to the Internet. If the routing table remains as you posted you will ...
4
votes
Where does the route to 169.254.0.0 comes from?
Pretty late to the party but I found this while troubleshooting a same or similar circumstance and discovered some additional things to consider. Realize OP's box may not even exist anymore, but I ...
4
votes
Accepted
How do VPN servers/clients avoid routing their own remote connection packets through themself?
You are correct that with purely destination-based routing this is a problem, if the destinations you are reaching through the tunnel overlap with routing needed for tunnel establishment, etc....
The ...
4
votes
Change default outgoing IP adress on latest Ubuntu
Yes, that is because Ubuntu sets the default route dynamically on every startup of the networking service. You can open /etc/network/interfaces and append your command under the interface like this:
...
4
votes
Is there a way to ssh using hostname alias without modifying the etc/hosts file?
Honestly, it's effortless.
In ~/.ssh/config:
Host node* server*
Hostname %h.domain.org
Now every “node” and “server” is mapped to the domain.
$ ssh node04 --> $ ssh node04.domain.org
$ ssh ...
4
votes
Accepted
How to change loopback network mask or redirect subnet to another interface
As mentioned in What is the rest of the 127.0.0.0/8 address space used for? , the 127.0.0.0/8 block is the loopback block, and all packets destined to the block must be looped back to the origin host.
...
4
votes
Accepted
Centos configure outbound IP address
You can change the source IP address used by default for outgoing connections using a command like the following:
ip route replace default via 87.233.82.97 dev eth0 src 87.233.82.98
Similarly, you ...
4
votes
What is the local routing table used for?
poige's answer covers that the local routing table is 1) special, 2)highest priority and 3) is maintained by the kernel, but it doesn't answer the question "What is the local routing table used ...
3
votes
IPv6 default gateway route disappear after reboot
Possibly these sysctl settings might help you?
net.ipv6.conf.all.autoconf=0
net.ipv6.conf.all.accept_ra=0
3
votes
How can I configure openvpn server without push default gateway?
I found that removing
resolv-retry infinite
from my client.conf stops pushing default route from server.
3
votes
How to exclude lan from routing
Instead of using iptables by itself, I recommend that you use a firewall management package like Shorewall to configure the firewall. There you can easily configure different zones in your network, ...
3
votes
How can I permanently remove a line in route with Debian-based distributions?
It seems a DHCP server give you this GW on ETH0.
edit this file : /etc/network/interfaces
gf_ way : use a static configuration for eth0 like :
iface eth0 inet static
address 192.168.1.x
netmask 255....
3
votes
Accepted
Connecting two networks using OpenVPN (all computers). Is that possible only from OpenVPN client's gateway or any computer?
YES.
What you want is called site to site VPN. Usually, one would use IPSEC here. It can be done with OpenVPN as well, though. You would install OpenVPN server on one machine, and a client on a ...
3
votes
openvpn --client-connect example script
Actually on server side inside the configuration file you can use:
# server vpn interface is up
up "/script/server_up.sh"
# server vpn interface is going down
down "/script/server_down....
3
votes
Routes for two openvpn connections (different hosts) in the same client
Main routing table
Only 1 default route is possible per routing table. If you want to add the routes to the main routing table, then you need to decide which gateway shall be used as default route.
...
3
votes
Accepted
Is there a way to ssh using hostname alias without modifying the etc/hosts file?
Yes, use ~/.ssh/config
Host bsd1
Hostname 10.9.9.2
User bsduser
Port 2243
Host web-backup
Hostname www-backup.example.com
User dauser
Port 2229
...
3
votes
Accepted
Add IP Routes and Rules at Startup
You can do this using /etc/network/interfaces file only.
You just have to put your add route command under the desired interface and put post-up or pre-down keywords before that command.
post-up ...
3
votes
Accepted
Route only packets from specific interface over VPN
First: the "half-default" route 128.0.0.0/1 (without its other half 0.0.0.0/1 ??) shouldn't exist if the router won't use the tunnel:
# ip route del 128.0.0.0/1 via 10.8.8.1 dev tun0
Since it's most ...
3
votes
Accepted
Some IP addresses are unreachable due to invalid route
Your default Gateway is 192.168.0.1. So, if there is no Static route, the traffic will go over the default gateway, except for directly connected Networks. In your example above for 172.17.56.70, you ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
route × 618networking × 157
linux × 154
iptables × 108
vpn × 77
ip × 74
routing × 73
openvpn × 73
linux-networking × 45
gateway × 38
ubuntu × 37
windows × 35
nat × 29
debian × 26
static-routes × 26
centos × 24
subnet × 20
iproute2 × 19
ifconfig × 19
interface × 18
router × 16
bridge × 16
ping × 14
ip-routing × 13
cisco × 11