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:
127.0.0.1 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

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
Output:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 ra0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 ra0

192.168.1.1 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
Output:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 ra0
default         wrt             0.0.0.0         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
0.0.0.0         192.168.1.254   0.0.0.0         UG        0 0          0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1
redhat

How To Change MTU Size In CentOS and Linux

I ran into an issue with LDAP replication failing for some our remote sites in South Africa. After some troubleshooting, it looks like the local ISP is restricting MTU. In order to resolve the dropped packet issues and make LDAP replication possible, we had to change the MTU on our local servers sending the packets.

This has to be done at the source, not just at the router/firewall. I’ve read that it’s best if they do match however. For instance, if you set the MTU to 1300 on the ethernet port, set the MTU to 1300 on the firewall. If you set the MTU at the firewall to 1300 and not the source, packet loss will still occur.

I did some basic troubleshooting to find the issue using a ping variation:
ping mydomain.com -f -l 1472

Pinging mydomain.com [172.16.61.1] with 1472 bytes of data:

Reply from 10.0.10.1:
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.

Ping statistics for 172.16.61.1:
Packets: Sent = 4, Received = 1, Lost = 3 (75% loss),

 

Solution: Permanently change MTU size on VM (my ping test gave me good results with 1300)

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Output:
DEVICE=eth0
TYPE=Ethernet
UUID=76a8c659-2a7e-459f-abf2-e81230a2ece5
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
#HWADDR=06:74:8A:00:17:D9 # Commented by Clonezilla
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME=”System eth0″

add a setting
MTU=”1300″

Esc
:wq!

Restart network service
service network restart

Verify change took
vi /etc/sysconfig/network-scripts/ifcfg-eth0

Output:
DEVICE=eth0
TYPE=Ethernet
UUID=76a8c659-2a7e-459f-abf2-e81230a2ece5
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
#HWADDR=06:74:8A:00:17:D9 # Commented by Clonezilla
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
MTU=”1300″
IPV6INIT=no
NAME=”System eth0″

After trying ping again, I received a good ping

 

 

After re-initializing my LDAP replication, it started and completed with no problem.