Monday 22 June 2015

How to configure Network on Linux RHEL7, CentOS-7

Linux (RHEL/CentOS-7)
--------------------
Physical NIC : enp2s0 or ens33 (start with 'en')
Virtual Machine NIC: eth0
virtual IP: enp2s0:1 or ens33:1 or eth0:1
loopback: lo
Bridge  : br0
wireless: wl
VMware NIC: eno16777736 - ethernet card information 
Host Name Configure
---------------------
[root@desktop1 ~]# hostname 

[root@desktop1 ~]# vim /etc/hostname
desktopX.example.com 
[root@desktop1 ~]# reboot

or

[root@desktopX ~]# hostname
[root@desktopX ~]# hostnamectl status
[root@desktopX ~]# hostnamectl --static set-hostname desktopX.example.com
[root@desktopX ~]# reboot

Check Physical Connectivity:
----------------------------
[root@desktopX ~]# mii-tool enp2s0 
enp2s0 : negotiated 1000baseT-FD flow-control, link ok
enp2s0 : no link (not connected) 

 
[root@desktopX ~]# ifconfig  en**  ; sepecific LAN
  ether 8C:89:A5:E4:F3:64 => MAC
  inet addr:192.168.0.X => IP Address
  Bcast:192.168.11.255
  Mask:255.255.255.0

N.B: (For Command Mode)
     [root@desktopX ~]# yum install net-tools* -y  (#ifconfig)
     [root@desktopX ~]# yum install setuptool -y

Check Default Gateway:
---------------------
[root@desktopX ~]# route -n
[root@desktopX ~]# route add default gw 192.168.11.1
[root@desktopX ~]# echo nameserver 8.8.8.8 >> /etc/resolv.conf 
[root@desktopX ~]# cat /etc/resolv.conf 

Gateway Testing
--------------------------
[root@desktopX ~]# ping 192.168.11.1
64 bytes from 192.168.11.1: icmp_seq=1 ttl=64 time=0.451 ms
64 bytes from 192.168.11.1: icmp_seq=2 ttl=64 time=0.317 ms

[root@desktopX ~]# ping -c 4 192.168.11.1

 IP Configure 
 --------------------------
  => Tempoary  (IP remove after system reboot)
  => Parmanet 

 Temporary IP Address Configure:
-------------------------------
[root@desktopX ~]# ifconfig 
[root@desktopX ~]# ifconfig eth0  192.168.11.200+X 
[root@desktopX ~]# ifconfig eth0  192.168.11.200+x netmask 255.255.255.0
[root@desktopX ~]# ifconfig

 IP Client Configure
 -------------------
  => Static
  => dhcp : autmatically ip configure

[root@desktopX network-scrip]# systemctl stop NetworkManager.service 
[root@desktopX network-scrip]# systemctl disable NetworkManager.service 
[root@desktopX network-scrip]# systemctl status NetworkManager.service 

 
Static (parmanent) IP configure:
--------------------------------
[root@desktopX ~]# cd /etc/sysconfig/network-scripts/
[root@desktopX network-scripts]# ls
[root@desktopX network-scripts]# vim ifcfg-eth0

 DEVICE="eth0"                    ; no change
 TYPE="Ethernet"                 ; no change
        HWADDR="AA:BB:CC:DD:EE:FF"      ; no change
 BOOTPROTO="none"               ; none/static=static
 IPADDR=X.X.X.X    (192.168.11.200+X)  ;X is your IP address
 NETMASK=Y.Y.Y.Y   (255.255.255.0)
 GATEWAY=X.X.X.G   (192.168.11.1)
 DNS1=A.A.A.A      (4.2.2.2)
 DNS2=B.B.B.B   (8.8.8.8)
 ONBOOT="yes"                   ; must yes 


[root@desktopX network-scripts]# systemctl restart network.service
[root@desktopX network-scripts]# systemctl enable network.service

[root@desktopX network-scrip]# ifconfig 

[root@desktopX ~]# nmtui-edit en***      ; Network Manager must be run 

 en i.e: enp2s0 or ens33 

Note: NM works only in GUI Mode

[root@desktopX ~]# ping 192.168.11.X 

No comments:

Post a Comment

How to install clamAV on Centos 6

  Install EPEL repo: Before we can do proceed, you must ensure that you have the EPEL yum repository enabled. To do this, CentO...