-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set gateway to each interface? #3
Comments
Not sure if this helps but I found that running pingu -v removes the routes when sopping it with ctrl+c. However, when I do service pingu start/stop the routes remain. |
This is what I am doing: ##Initial condition: alpine in docker with CAP_NET_ADMIN
##and connected 3 networks.
apk add iproute2 pingu
ifconfig
#(3 interface returned. eth0 eth1 eth2)
#(eth0 is internal , eth1 is interface1 with macvlan, eth2 is interface2 with macvlan)
##enable NAT
sysctl net.ipv4.ip_forward=1
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE
##set gateway ↓gateway1↓ ↓gateway2↓
ip route change default nexthop via 192.168.0.254 dev eth1 weight 1 nexthop via 192.168.11.50 dev eth2 weight 1
#Now I can get internet access, package will randomly choose eth1 or eth2 to send
ip route list
#default
# nexthop via 192.168.0.254 dev eth1 weight 1
# nexthop via 192.168.11.50 dev eth2 weight 1
#172.18.0.0/24 dev eth0 proto kernel scope link src 172.18.0.4
#192.168.0.0/24 dev eth1 proto kernel scope link src 192.168.0.2
#192.168.11.0/24 dev eth2 proto kernel scope link src 192.168.11.3
vi /etc/pingu/pingu.conf
#interval 30
#retry 5
#required 3
#timeout 1.0
#interface eth1 {
# label ISP via eth1
# rule-priority 20000
# required-hosts-online 1
# load-balance
#}
#
#interface eth2 {
# label ISP via eth2
# rule-priority 20000
# required-hosts-online 1
# load-balance
#}
#host 8.8.8.8 {
# label Google public DNS (via eth1)
# bind-interface eth1
# bind-interface eth2
#}
##start pingu
pingu
#pingu[49]: New interface: eth1
#pingu[49]: eth1: got link
#pingu[49]: New interface: eth2
#pingu[49]: eth2: got link
#pingu[49]: New route to 192.168.0.0/24 dev eth1 metric 0 table 2
#pingu[49]: New route to 192.168.11.0/24 dev eth2 metric 0 table 1
#pingu[49]: Google public DNS (via eth1): went OFFLINE
#pingu[49]: 8.8.4.4: went OFFLINE
#pingu[49]: ISP via eth2: went OFFLINE
#pingu[49]: 8.8.4.4: went OFFLINE
#pingu[49]: ISP via eth1: went OFFLINE
######Now I can no longer access the internet##########
ip route list
#172.18.0.0/24 dev eth0 proto kernel scope link src 172.18.0.4
#192.168.0.0/24 dev eth1 proto kernel scope link src 192.168.0.2
#192.168.11.0/24 dev eth2 proto kernel scope link src 192.168.11.3
##getway record has been removed Any step I do is wrong? |
I have not played with the loud-balance option. Im only wanting pingu to switch between the two if one goes down (will be handled with gateway up/down action in pingu.conf). Here is what I have in my interfaces file: auto eth2 interface eth2 { If you notice, the route-table and rule-priority match the table I use in the interfaces file. This way the routes persist and no new route is added or removed when pingu starts or stops. |
I want to set gateway in conf
if I set
pingu will remove all my route settings.
But if I set gateway=192.168.0.254
I will get error like this:
The text was updated successfully, but these errors were encountered: