티스토리 뷰

 

 

CentOS7을 처음 설치하게 되면 설치 조건에 따라 종종 net-tools 패키지가 설치되지 않는 경우가 있다.

 

이럴경우 기존 CentOS6 이하 버전에서 사용되던 ifconfig등의 명령어를 수행할 수 없어 network 설정에 있어 어려움이 있을 수 있다.

 

CentOS7 버전부터는 NetworkManager 서비스를 기본 네트워크 관리 서비스로 채용하고 있으며 설정 방법은 아래와 같다.

 

 

1.  NetworkManager 서비스 기동여부 확인

 

 

 

[root@centos7 /]#
[root@centos7 /]# systemctl status NetworkManager
NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled)
   Active: active (running) since Fri 2015-01-02 13:44:52 KST; 2min 16s ago
 Main PID: 824 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           └─824 /usr/sbin/NetworkManager --no-daemon

[root@centos7 /]#
[root@centos7 /]#

 

 

2. NetworkManager 서비스가 기동되어 있지 않을경우 아래와 같이 기동

 

[root@centos7 ~]#
[root@centos7 ~]# systemctl list-unit-files | grep NetworkManager
dbus-org.freedesktop.NetworkManager.service enabled
NetworkManager-dispatcher.service           enabled
NetworkManager-wait-online.service          disabled
NetworkManager.service                      disabled
[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]# systemctl enable NetworkManager.service
[root@centos7 ~]#
[root@centos7 ~]# systemctl start NetworkManager.service
[root@centos7 ~]#
[root@centos7 ~]# systemctl status NetworkManager.service
NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled)
   Active: active (running) since Fri 2015-01-02 14:59:01 KST; 2h 21min ago
 Main PID: 9504 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           ???€9504 /usr/sbin/NetworkManager --no-daemon

Jan 02 17:20:36 centos7 systemd[1]: Started Network Manager.
[root@centos7 ~]#
[root@centos7 ~]#

 

 

3. Network Device 연결 상태 확인하기

 

[root@centos7 /]#
[root@centos7 /]# nmcli device
DEVICE  TYPE      STATE         CONNECTION
enp0s3  ethernet  disconnected  --        
lo      loopback  unmanaged     --        
[root@centos7 /]#

혹은 아래와 같이 Alias로 옵션수행

 

[root@centos7 /]#
[root@centos7 /]# nmcli d
DEVICE  TYPE      STATE         CONNECTION
enp0s3  ethernet  disconnected  --        
lo      loopback  unmanaged     --        
[root@centos7 /]#
[root@centos7 /]#

 

 

 

4. 네트워크 Config Script 수동 작성

 

[root@centos7 /]#
[root@centos7 /]# cd /etc/sysconfig/network-scripts/
[root@centos7 network-scripts]#
[root@centos7 network-scripts]#
[root@centos7 network-scripts]# vi ifcfg-enp0s3
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=enp0s3
UUID=567cbcc2-dd0c-4ea0-af1c-2057b4c4467a
ONBOOT=yes
HWADDR=08:00:27:19:5C:C6
IPADDR=192.168.137.70
NETMASK=255.255.255.0
GATEWAY=192.168.137.1
DNS1=168.126.63.1
[root@centos7 network-scripts]#
[root@centos7 network-scripts]#
[root@centos7 network-scripts]#
[root@centos7 network-scripts]# vi /etc/sysconfig/network
# Created by anaconda
NETWORKING=YES
HOSTNAME=centos7
GATEWAY=192.168.137.1
[root@centos7 network-scripts]#
[root@centos7 network-scripts]#
[root@centos7 network-scripts]# vi /etc/resolv.conf
# Generated by NetworkManager
nameserver 168.126.63.1
[root@centos7 network-scripts]#

 

 

5. Network 서비스 재기동 및 IP 할당 상태 확인

 

[root@centos7 network-scripts]#
[root@centos7 network-scripts]# systemctl restart NetworkManager
[root@centos7 network-scripts]#
[root@centos7 network-scripts]# systemctl restart network
[root@centos7 network-scripts]#

[root@centos7 network-scripts]# 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 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:19:5c:c6 brd ff:ff:ff:ff:ff:ff
    inet 192.168.137.70/24 brd 192.168.137.255 scope global enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe19:5cc6/64 scope link
       valid_lft forever preferred_lft forever

[root@centos7 network-scripts]#
[root@centos7 network-scripts]#
[root@centos7 network-scripts]# ping -c 5 -i 0.1 192.168.137.1
PING 192.168.137.1 (192.168.137.1) 56(84) bytes of data.
64 bytes from 192.168.137.1: icmp_seq=1 ttl=128 time=0.305 ms
64 bytes from 192.168.137.1: icmp_seq=2 ttl=128 time=0.206 ms
64 bytes from 192.168.137.1: icmp_seq=3 ttl=128 time=0.231 ms
64 bytes from 192.168.137.1: icmp_seq=4 ttl=128 time=0.265 ms
64 bytes from 192.168.137.1: icmp_seq=5 ttl=128 time=0.094 ms

--- 192.168.137.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 403ms
rtt min/avg/max/mdev = 0.094/0.220/0.305/0.071 ms
[root@centos7 network-scripts]#
[root@centos7 network-scripts]#
[root@centos7 network-scripts]#
[root@centos7 network-scripts]# nslookup google.com
Server:  168.126.63.1
Address: 168.126.63.1#53

Non-authoritative answer:
Name: google.com
Address: 173.194.126.233
Name: google.com
Address: 173.194.126.238
Name: google.com
Address: 173.194.126.224
Name: google.com
Address: 173.194.126.225
Name: google.com
Address: 173.194.126.226
Name: google.com
Address: 173.194.126.227
Name: google.com
Address: 173.194.126.228
Name: google.com
Address: 173.194.126.229
Name: google.com
Address: 173.194.126.230
Name: google.com
Address: 173.194.126.231
Name: google.com
Address: 173.194.126.232

[root@centos7 network-scripts]#

 

 

6. Text User Interface 환경으로 설정 (CUI 가 아닌 TUI 환경)

 

[root@centos7 ~]#
[root@centos7 ~]# nmtui
[root@centos7 ~]#
[root@centos7 /]#

 

 

 

 

 


 

반응형
반응형
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday