What is the use of /etc/udev/rules.d/70-persistent-net.rules file in Rhel/Centos?

what is the use of /etc/udev/rules.d/70-persistent-net.rules file in linux? is anyother way to change interface name in linux other than 70-persistent-net.rules?

This file associates your NIC’s MAC address with an interface name that will be given to the NIC at startup. There are certainly ways to change the name at runtime but if you reboot, it’s gonna be the contents of that file that count.

Additionally, you can use it for renaming the interfaces

Neighbor table overflow Error in Linux

The ‘neighbor table overflow’ is a VERY common linux issue on large networks. Some network trigger this with default linux settings (because the previous network regime put so many IP address subnets on a single vlan , it creates large ARP tables – which is not normal / default settings). It is not an indication of anything wrong. It is a trigger of linux default.

Here is how to adjust:
If you see this….

__ratelimit: 20 callbacks suppressed
Neighbour table overflow.

For busy networks increase the kernel’s internal ARP cache size. The following kernel variables are used:

To see current values, type:

Run this…

# sysctl net.ipv4.neigh.default.gc_thresh1
net.ipv4.neigh.default.gc_thresh1 = 128

# sysctl net.ipv4.neigh.default.gc_thresh2
net.ipv4.neigh.default.gc_thresh2 = 512

# sysctl net.ipv4.neigh.default.gc_thresh3
net.ipv4.neigh.default.gc_thresh3 = 1024

You need to make sure that the arp table to become bigger than the above defaults. The above limitations are good for small network or a single server. This will also affect your DNS traffic.

How Do I Fix “Neighbour Table Overflow” Error?

# vi /etc/sysctl.conf

Append the following:

 ## works best with <= 500 client computers ##
# Force gc to clean-up quickly
net.ipv4.neigh.default.gc_interval = 3600
# Set ARP cache entry timeout
net.ipv4.neigh.default.gc_stale_time = 3600
# Setup DNS threshold for arp
net.ipv4.neigh.default.gc_thresh3 = 4096
net.ipv4.neigh.default.gc_thresh2 = 2048
net.ipv4.neigh.default.gc_thresh1 = 1024

To load new changes type the following command:

# sysctl -p

Add private IP to Debian Ubuntu for R1

Add the IP as Eth0 when the primary is Eth1 (no gateway)

# nano /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
hwaddress 0C:C4:7A:6A:0F:E4

auto eth1
iface eth1 inet static
address 206.xxx.xx.xx
gateway 206.xxx.xx.1
hwaddress 0C:C4:7A:6A:0F:E5

Test server download speeds

Server connections speeds are a function of a variety of variables. The server’s connection speed to the Internet, all processes that are simultaneously trying to connect (uploads and downloads share the total speed available), the overall health of the Internet and the connection capability of the off-site computer, which is also limited by the same factors.

You can test the download speed of a Linux server by downloading a very large file and watching the speed.

# cd /tmp

500 MB

# wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip


# wget --output-document=/dev/null http://cachefly.cachefly.net/100mb.test



The Difference between a Megabyte (MB) and a Megabit (Mb)

Do you think 1 Megabit per second (1 Mbps) will allow you to download a 1 Megabyte file in one second?

This is not the case. A Megabit is 1/8 as big as a Megabyte.

1 Megabyte = 8 Megabits
Mbps = Megbits per second
MBps = MegBytes per second
Internet speed is usually measured in megabits per second

So, to download a 1MB file in 1 second you would need a connection of 8Mbps ( 8 Megbits per second). The difference between a Gigabyte (GB) and a Gigabit (Gb) is the same, with a Gigabyte being 8 times larger than a Gigabit.

To calculate how long it will take a file to download over your connection, you can use Google’s simple MB/Mb converter:


Netstat Commands for DDoS Checking

Useful commands to check if a server is getting ddos’d

Show IPs with more than 10 connections open:

# netstat -nat | grep ":80" | awk -F: '{print $8}' | sort | uniq -c | sort -n | awk '{ if ( $1 > 10) print $2 ; }'

Show # of connections open per IP

# netstat -nat | egrep ":80|:443" | awk -F: '{print $8}' | sort | uniq -c | sort -n 

Number of connections per IP

# netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

Haynie’s version(better sorting):

# netstat -anp|awk '{print $5}'|awk -F: '{print $4}'|sort -n -t. -k1,1 -k2,2 -k3,3 -k4,4|uniq -c|sort -n

Drop ips with 100 or more connections:

# netstat -nat | egrep ":80|:443" | awk -F: '{print $8}' | sort | uniq -c | sort -n | awk '{ if ( $1 > 100) print $2 ; }' | xargs -n1 echo iptables -I INPUT -j DROP -s

Graphic netstat connections(# of connections open per host)

# netstat -an | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | awk '{ printf("%s\t%s\t",$2,$1) ; for (i = 0; i < $1; i++) {printf("*")}; print "" }'

Change Hostname in CentOS

Open the /etc/sysconfig/network file with your favorite text editor. Modify the HOSTNAME= value to match your FQDN host name.

# nano /etc/sysconfig/network

Change the host that is associated to your main IP address for your server, this is for internal networking (found at /etc/hosts):

nano /etc/hosts
192.xx.xx.xx myserver.domain.com


The ‘hostname’ command will let you change the hostname on the server that the commandline remembers, but it will not actively update all programs that are running under the old hostname.

# hostname myserver.domain.com
# hostname

Restart Networking

At this point all the necessary changes that needed to be made have been made, you will want to restart networking on your server to make sure that changes will be persistent on reboot:

# /etc/init.d/network restart

* Hostname reports nothing

# hostname

Try this

$ stat /bin/hostname
File: `/bin/hostname'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 803h/2051d Inode: 40616045 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2015-03-13 05:10:01.000000000 -0700
Modify: 2014-12-15 15:33:57.000000000 -0700
Change: 2014-12-15 15:33:57.000000000 -0700

Notice the “empty file”
Reinstall the package – the package it’s included in (net-tools-1.60-110.el6_2.x86_64).

Now Check

# stat /bin/hostname
  File: `/bin/hostname'
  Size: 17848           Blocks: 40         IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 269246      Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2015-03-13 04:47:35.065993289 -0600
Modify: 2012-05-10 03:17:33.000000000 -0500
Change: 2015-01-30 03:29:41.959201490 -0600

How to Check an IP Address, Routes and links

To get the depth information of your network interfaces like IP Address, MAC Address information, use the following command as shown below.

# ip addr show

$ sudo ip addr show

]# ip addr show
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 scope host lo
    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 00:0c:29:44:43:24 brd ff:ff:ff:ff:ff:ff
    inet 216.xx.xx.xx/24 brd 216.xx.xx.255 scope global eth0
    inet6 fe80::20c:29ff:fe44:4324/64 scope link
       valid_lft forever preferred_lft forever

# ip route show
216.xx.xxx.0/24 dev eth0  proto kernel  scope link  src 216.xx.xxx.xxx dev eth0  scope link  metric 1002
default via 216.xx.xxx.1 dev eth0

#  ip link show
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
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:44:43:24 brd ff:ff:ff:ff:ff:ff

How to Setup networking on centos 7

Source: http://www.krizna.com/centos/setup-network-centos-7/

When installing Centos 7, You may not able to connect network in that machine. This will happen because Ethernet interfaces are not enabled by default and need additional configuration.

Type “nmcli d” command in your terminal

# nmcli d

Recommended for beginners
Step 1 » Type this command “nmtui” to open Network manager and press enter after choosing ” Edit a connection” ( Use TAB for choosing options ) .

Command Line

Network interface config files are located in /etc/sysconfig/network-scripts/ directory. Open ifcfg-en…

nano /etc/sysconfig/network-scripts/ifcfg-en



and replace with


And add the below lines at the end of the file.

DNS1= will look like below after changes.

# systemctl restart network

Additionally you can use /etc/sysconfig/network file for hostname and DNS.