To configure the IP address in centos first find the interface using the command from the command line interface in centos
[root@localhost ~]# nmcli d
DEVICE TYPE STATE CONNECTION
eno1 ethernet connected eno1
eno2 ethernet disconnected --
lo loopback unmanaged --
You can also use the ip addr command to see the ip address of the interface
\\[root@localhost ~]# ip addr
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 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
Now to configure the ip address from the CLI you need to edit the file using the vi editor
The file name will end with the interface identifier
for example for eno1 the file name will be ifcfg-eno1.
The directory where you will find the file is /etc/sysconfig/network-scripts
now edit the file using the vi editor
fill the paramater for static configuration as below
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno1
UUID=973e193a-1da9-444f-ac9d-927c065ad9f3
DEVICE=eno1
ONBOOT=yes
IPADDR=10.9.60.128
NETMASK=255.255.255.0
GATEWAY=10.9.60.254
DNS1=10.9.60.20
DNS2=10.9.60.21
Once that is done
Restart the network service using the command systemctl restart network
You can also use the /etc/sysconfig/network to configure the domain and dns etc as follows
To see the status and IP address of the interface the command is ip addr
To restart network service command is service network restart
In centos 6 the command to check interface is ifconfig
In case of any issue check the journalctl -xn
IP link status
ip link show
Shutdown command is
systemctl poweroff
shutdown now
shutdown -P now
shutdown -H now
systemctl shutdown
Reference:
http://www.ducea.com/2006/08/07/how-to-change-the-hostname-of-a-linux-system/
http://www.itzgeek.com/how-tos/linux/centos-how-tos/change-hostname-in-centos-7-rhel-7.html
Cronjob:
https://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/
Disable crontab
[root@localhost ~]# nmcli d
DEVICE TYPE STATE CONNECTION
eno1 ethernet connected eno1
eno2 ethernet disconnected --
lo loopback unmanaged --
You can also use the ip addr command to see the ip address of the interface
\\[root@localhost ~]# ip addr
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 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
Now to configure the ip address from the CLI you need to edit the file using the vi editor
The file name will end with the interface identifier
for example for eno1 the file name will be ifcfg-eno1.
The directory where you will find the file is /etc/sysconfig/network-scripts
now edit the file using the vi editor
fill the paramater for static configuration as below
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno1
UUID=973e193a-1da9-444f-ac9d-927c065ad9f3
DEVICE=eno1
ONBOOT=yes
IPADDR=10.9.60.128
NETMASK=255.255.255.0
GATEWAY=10.9.60.254
DNS1=10.9.60.20
DNS2=10.9.60.21
Once that is done
Restart the network service using the command systemctl restart network
You can also use the /etc/sysconfig/network to configure the domain and dns etc as follows
HOSTNAME=Hostname
DNS1=4.4.4.4
DNS2=8.8.8.8
SEARCH=doamin.com
To see the status and IP address of the interface the command is ip addr
To restart network service command is service network restart
In centos 6 the command to check interface is ifconfig
In case of any issue check the journalctl -xn
IP link status
ip link show
dmesg | grep eth
Shutdown command is
systemctl poweroff
shutdown now
shutdown -P now
shutdown -H now
systemctl shutdown
Reference:
http://www.ducea.com/2006/08/07/how-to-change-the-hostname-of-a-linux-system/
http://www.itzgeek.com/how-tos/linux/centos-how-tos/change-hostname-in-centos-7-rhel-7.html
Cronjob:
https://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/
Disable crontab
crontab -e
then comment out each line you don't want to run with #
.
No comments:
Post a Comment