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 
[root@desktop1 ~]# reboot


[root@desktopX ~]# hostname
[root@desktopX ~]# hostnamectl status
[root@desktopX ~]# hostnamectl --static set-hostname
[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

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
[root@desktopX ~]# echo nameserver >> /etc/resolv.conf 
[root@desktopX ~]# cat /etc/resolv.conf 

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

[root@desktopX ~]# ping -c 4

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

 Temporary IP Address Configure:
[root@desktopX ~]# ifconfig 
[root@desktopX ~]# ifconfig eth0 
[root@desktopX ~]# ifconfig eth0 netmask
[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    (  ;X is your IP address
 DNS1=A.A.A.A      (
 DNS2=B.B.B.B   (
 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