Skip to content
This repository was archived by the owner on Jul 20, 2024. It is now read-only.

Prevent setting default route to eth0 after reboot #42

Merged
merged 1 commit into from
Jan 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prevent setting default route to eth0 after reboot
  • Loading branch information
int128 authored Jan 23, 2022
commit d96d66c14f95d1a59e6b02fbdba5e4c7c62c5ea8
6 changes: 5 additions & 1 deletion snat.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash -x
#!/bin/bash
set -x

# wait for eth1
while ! ip link show dev eth1; do
Expand All @@ -10,6 +11,9 @@ sysctl -q -w net.ipv4.ip_forward=1
sysctl -q -w net.ipv4.conf.eth1.send_redirects=0
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

# prevent setting the default route to eth0 after reboot
rm -f /etc/sysconfig/network-scripts/ifcfg-eth0

# switch the default route to eth1
ip route del default dev eth0

Expand Down