I ran through hell today!
I tried doing things the old way. You know; edit /etc/sysconfig/network-scripts/ifcfg-eth1 in order to set it to a static IP. Well, bad idea.
I had all kinds of problems when the two interfaces where online (eth0 and eth1). For example:
- eth0, even having BOOTPROTO=dhcp, would get the static IP address of eth1.
- eth1 would get an IPv6 address but not it's static address.
- network.service would NOT work at all.
So, my solution. Use NetworkManager.
I found that we have nmtui and nmcli. The former has a Terminal User Interface (TUI); which makes it friendlier to the average user. The former, is a CLI application; which makes it friendlier for scripting and nerds.
I preferred nmcli; since I like remembering stuff in scripts. So, here is how to do it:
nmcli c add type ethernet ifname eth1 con-name private autoconnect yes save yes ip4 192.168.1.10/24 nmcli c modify eth1 ipv4.ignore-auto-routes yes ipv4.ignore-auto-dns yes ipv4.may-fail no
That command will and eth1 with "private" as it's friendly anme and will connect on boot and persist in configuration. We, also, remove auto routes and auto dns; and make it fail loudly!
Check out the man page to add more stuff like default routes and stuff.