CentOS 7

How To Disable IPv6 In CentOS 7

CentOS Linux release 7.0.1406 (Core)

Verify Centos Version
cat /etc/centos-release

I’ve discovered bugs in some install packages. One such package is Zimbra. To work around these bugs, IPv6 and associated dependencies need to be disabled.

To disable IPv6 in a CentOS 7 installation, perform the following tasks:

Task 1
Navigate to and create a file inside/etc/modprobe.d/.
(The name of the file can be anything, I chose “disable-ipv6”)
cd /etc/modprobe.d/
nano disable-ipv6
Add this line
install ipv6 /bin/true
Press “Ctl+X” to exit
Select “Y” to save changes
Press “Enter” to get back to CL

Task 2
Comment Out Hosts Entry
nano /etc/hosts
By default, this is what’s present: localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Comment out
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Press “Ctl+X” to exit
Select “Y” to save changes
Press “Enter” to get back to CL

Task 3
Reboot the system to complete the process. It is required.

CentOS 7

iptables on Centos 7

With RHEL 7 / CentOS 7, firewalld  was introduced to manage iptables. IMHO, firewalld is more suited for workstations than for server environments.

It is possible to go back to a more classic iptables setup. First, stop and mask the firewalld service:

systemctl stop firewalld
systemctl mask firewalld

Then, install the iptables-services package:

yum install iptables-services

Enable the service at boot-time:

systemctl enable iptables

Managing the service

systemctl [stop|start|restart] iptables

Saving your firewall rules can be done as follows:

service iptables save


/usr/libexec/iptables/iptables.init save
CentOS 7

ifconfig on CentOS 7

The utility has been deprecated, but if you want to use it, just install net-tools.

yum -y install net-tools


If you are are ready to move from the ifconfig command, alternatively, you can get your IP address using the ip command:

ip addr sh
Linux Gateway

How To Find Linux Gateway Address

This is NOT my work. I’ve just added it to my blog. The original post and author can be found here.

Find out Gateway / router IP address under Linux / UNIX using route command

You need to use route command. This command can manipulates the kernel’s IP routing tables. It can be also use to print gateway / router IP address. Type the following command to see default gateway:
$ route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface   U     0      0        0 ra0         UG    0      0        0 ra0 is gateway IP address for our computer. The flag U indicates that route is up andG indicates that it is gateway. You can print gateway name, enter:
$ route

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     *        U     0      0        0 ra0
default         wrt            UG    0      0        0 ra0

Second column prints Gateway hostname / IP address. In our example wrt is gateway.

netstat command example to find out gateway/router IP

Open a terminal and type the following command:
# netstat -r -n
Sample outputs:

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface         UG        0 0          0 eth1   U         0 0          0 eth1