BLOG BKHOST / VPS ( MÁY CHỦ ẢO ) / Hướng dẫn cấu hình IP tĩnh trên Centos 7

Hướng dẫn cấu hình IP tĩnh trên Centos 7

Centos-Logo

Question:

How to switch from Dynamic to static in my CentOS 7?

Answer:

Before to convert from dynmic to static, please make an copy of resolv.conf under etc folder.

cp /etc/resolv.conf /etc/resolv.conf.backup

1 – Please edit “/etc/sysconfig/network-scripts/ifcfg-enp0s3”.

TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPADDR=10.1.1.200
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s3
UUID=75a170ba-6bfa-4553-8070-e658eb8ffb1e
ONBOOT=yes

save and exit.

2 – Set gateway and networking

vi /etc/sysconfig/network
#add  
NETWORKING=yes
HOSTNAME=unixmen-centos7
GATEWAY=10.1.1.253

save and exit.

3 Restart your network or reboot

4 – Restore the resolv.conf backup file.

Check your network again:

[root@localhost ~]# ip  a
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
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:7a:7a:3f brd ff:ff:ff:ff:ff:ff
    inet 10.1.1.200/8 brd 10.255.255.255 scope global enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe7a:7a3f/64 scope link
       valid_lft forever preferred_lft forever
[root@localhost ~]#

5 – PING

[root@localhost ~]# ping  google.nl
PING google.nl (173.194.65.94) 56(84) bytes of data.
64 bytes from ee-in-f94.1e100.net (173.194.65.94): icmp_seq=1 ttl=48 time=7.20 ms
64 bytes from ee-in-f94.1e100.net (173.194.65.94): icmp_seq=2 ttl=48 time=7.61 ms
64 bytes from ee-in-f94.1e100.net (173.194.65.94): icmp_seq=3 ttl=48 time=7.22 ms
64 bytes from ee-in-f94.1e100.net (173.194.65.94): icmp_seq=4 ttl=48 time=7.87 ms
64 bytes from ee-in-f94.1e100.net (173.194.65.94): icmp_seq=5 ttl=48 time=7.49 ms

Done.

About admin

XEM THÊM

máy chủ là gì

Máy chủ server là gì? Nó quan trọng như thế nào?

Máy chủ server là gì? Server là tên tiếng anh dịch sang tiếng Việt có …

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *