CentOS 7から、Network Managerが導入されたので、ちょっと勉強し直しが必要ですね。
1.インターフェース名を整理
NMで管理されているインターフェースに日本語名が付与されていたので、まず直します
[[email protected] ~]# nmcli connection show 名前 UUID タイプ デバイス 有線接続 1 69e95758-f0b1-436b-bf4f-77c99aa4202f 802-3-ethernet eth1 eth0 68afec23-b764-475d-a590-b5e4477e0b28 802-3-ethernet eth0 [[email protected] ~]# LANG=C nmcli connection show NAME UUID TYPE DEVICE ???? 1 69e95758-f0b1-436b-bf4f-77c99aa4202f 802-3-ethernet eth1 eth0 68afec23-b764-475d-a590-b5e4477e0b28 802-3-ethernet eth0 [[email protected] ~]# nmcli connection delete 69e95758-f0b1-436b-bf4f-77c99aa4202f Connection '有線接続 1' (69e95758-f0b1-436b-bf4f-77c99aa4202f) successfully deleted. [[email protected] ~]# nmcli connection show 名前 UUID タイプ デバイス eth0 68afec23-b764-475d-a590-b5e4477e0b28 802-3-ethernet eth0 [[email protected] ~]# nmcli connection add type eth ifname eth1 con-name eth1 接続 'eth1' (b208257f-b48f-4326-b185-a5a33269bc24) が正常に追加されました。 [[email protected] ~]# nmcli connection show 名前 UUID タイプ デバイス eth1 b208257f-b48f-4326-b185-a5a33269bc24 802-3-ethernet eth1 eth0 68afec23-b764-475d-a590-b5e4477e0b28 802-3-ethernet eth0
2.IPマスカレード設定
[[email protected] ~]# nmcli c mod eth1 connection.zone external [[email protected] ~]# nmcli c mod eth0 connection.zone internal [[email protected] ~]# firewall-cmd --list-all public (default) interfaces: sources: services: dhcp dhcpv6-client squid ssh ports: masquerade: no forward-ports: icmp-blocks: rich rules: [[email protected] ~]# firewall-cmd --zone=external --add-masquerade --permanent success [[email protected] ~]# firewall-cmd --reload success [[email protected] ~]# firewall-cmd --zone=external --query-masquerade yes [[email protected] ~]# cat /proc/sys/net/ipv4/ip_forward 1