How to properly create file for firewall network-interface in CentOS 7.1?
I read a very good publication regarding firewall. It says about files
/etc/sysconfig/network-scripts/ifcfg-ethX , where X it is number network-interface.
The following command shows that I have two interfaces:
public interfaces: eth0 eth1
But I have no such file
/etc/sysconfig/network-scripts/ifcfg-eth1 , only
When I create a empty file
/etc/sysconfig/network-scripts/ifcfg-eth1 and restart the network, I have error:
$ sudo systemctl restart network.service Job for network.service failed. See 'systemctl status network.service' and 'journalctl -xn' for details. $ systemctl status network.service network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network) Active: failed (Result: exit-code) since Thu 2015-11-12 08:22:39 EET; 23s ago Process: 5560 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS) Process: 5832 ExecStart=/etc/rc.d/init.d/network start (code=exited,status=1/FAILURE)
I assume that each interface has to be limited by own IP-address. But I have only one public IPv4. I can have more than one firewall-zone, in such a case?
ip addr such
$ ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 04:01:84:4d:d3:01 brd ff:ff:ff:ff:ff:ff inet 188.8.131.52/18 brd 184.108.40.206 scope global eth0 valid_lft forever preferred_lft forever inet 10.19.0.5/16 brd 10.19.255.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::601:84ff:fe4d:d301/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 04:01:84:4d:d3:02 brd ff:ff:ff:ff:ff:ff inet6 fe80::601:84ff:fe4d:d302/64 scope link valid_lft forever preferred_lft forever
So, how to properly create file
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.