How to set default route when gateway has dynamic IP?
I am making an edge-router server from Fedora 20. Now I am stuck on the last step, where I need to forward all non-local packets out to the WAN.
I have four NICS and a bridge on this server. All are defined in /etc/sysconfig/network-scripts/ifcfg-*. Only lan0 and wan0 use NetworkManager.
wan0 -> internet. Defined in ifcfg-wan0. Gets ip via dhcp
lan0 -> Local network. Defined in ifcfg-lan0. No IP, bridged to br0.
br0-> Local network. Defined in ifcfg-br0. Static IP (192.168.0.xxx).
wifi0-> Local network. Defined in ifcfg-wifi0. Managed via hostapd. Bridged to br0
wifi1-> Local network. Defined in ifcfg-wifi1. Managed via hostapd. Bridges to br0
For testing, I defined a gateway in /etc/sysconfig/network, as is recommended by RedHat. But this machine will BE the gateway, and the external IP is dynamic. I therefore removed it, but should it be GATEWAY=127.0.0.1?
After boot I can manually execute
ip route change default via XXX.XXX.XXX.XXX dev wan0
But I obviously need this to be set automatically. How do I do that?
Thanks!
PS. This machine uses iptables and NAT to direct the traffic of other hosts on my network to the WAN. The bridge is for hostapd WIFI.
|