Contenu connexe
Similaire à Enterprise Linux 7 new feature_network configuration (20)
Enterprise Linux 7 new feature_network configuration
- 1. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Enterprise Linkx 7 New Feature
RHEL , OEL , CentOS , Fedora
Suk Kim , Oracle ACE Director
Nobreak Senior managed Consultant
- 2. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
저작권
저작권 동의 및 이용에 관하여
본 문서의 저작권은 모두 저작자에게 있습니다.
본 문서의 상업적 이용을 금합니다.
(무단 복제, 전제, 임의 수정 및 저작권 정보 수정 등의 행위 일체 금지)
본 문서의 이용은 개인 학습용으로만 가능합니다.
• Contacts : ostoneo@gmail.com
- 3. 목차
네트워크 구성
레거시 네트워크 구성
NetworkManager 의 설치 및 구성
네트워크 인터페이스 이름 변경
nmcli , network manager를 이용한 네트워크 연결 구성
- 4. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
발표자 소개
김석 ( nick : 김재벌 )
현) 오라클 에이스 디렉터 ( Oracle ACE Director )
현) 주식회사 노브레이크 수석컨설던트 / 대표이사
현) 안산대학교 IT응용보안과 겸임교수
현) 한양사이버대학교 해킹보안과 교수
현) 솔라리스 테크넷 운영자
현) 솔라리스 스쿨 운영자
현) 블로그 “김재벌의 IT 이야기”
- 6. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
레거시 네트워크 구성
전통적인 시스템의 네트워크 구성
ifconfig 와 route 명령들을 이용한 구성
/etc/sysconfig/network-scripts/ifcfg-ethX 파일 직접 수정
service 명령어를 통한 재시작
최근의 시스템은 NetworkManager 에 의해 제어됨.
• /etc/hosts
• /etc/resolv.conf
• /etc/hostname
• /etc/sysconfig/network
• /etc/sysconfig/network-scripts/ifcfg-ethX
• #service network stop | start | restart
• chkconfig [--level <레벨>] [--type <종류>] <이름>
<on|off|reset|resetpriorities>
• # system-config-network
• netstat -nr
• route
- 7. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
네트워크 구성
Service 방식 사용 ( NetworkManager 비활성화)
인터페이스 파일의 NM_CONTROLLED=no 설정
라우팅 확인
[root@el7 ~]# systemctl enable network.service
network.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig network on
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
[root@el7 ~]# systemctl restart network.service
[root@el7 ~]# systemctl stop NetworkManager.service
[root@el7 ~]# systemctl disable NetworkManager.service
rm '/etc/systemd/system/multi-user.target.wants/NetworkManager.service'
rm '/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service'
rm '/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service'
- 8. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
network manager 의 설치 및 구성
[root@el7 ~]# yum -y install NetworkManager
- 9. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
network manager 의 설치 및 구성
[root@el7 ~]# systemctl status NetworkManager
[root@el7 ~]# systemctl start NetworkManager
[root@el7 ~]# systemctl enable NetworkManager
- 10. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
RHEL7 / OEL 7 네트워크 설정 확인
1. 인터페이스 확인
[root@el7 /]# 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
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000 link/ether 00:0c:29:21:a6:95 brd ff:ff:ff:ff:ff:ff
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state
DOWN link/ether 82:51:91:6a:74:61 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
인터페이스 이름이 ethX 가
아님???
en:Ethernet
o : on board
노트 http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-net_id.c#n20
- 11. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
RHEL7 / OEL 7 인터페이스명 변경
2. grub 설정 변경
[root@el7 ~]# vi /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="vconsole.font=latarcyrheb-sun16 vconsole.keymap=ko
net.ifnames=0 biosdevname=0 rd.lvm.lv=ol/root crashkernel=auto rd.lvm.lv=ol/swap
rhgb quiet"
GRUB_DISABLE_RECOVERY="true“
3.grub.cfg 파일 재생성
[root@el7 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
붉은색 부분을 추가
- 12. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
RHEL7 / OEL 7 인터페이스명 변경
4.grub.cfg 설정 반영 여부 확인
[root@el7 /]# vi /boot/grub2/grub.cfg
- 13. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
RHEL7 / OEL 7 인터페이스명 변경
5. 인터페이스 설정 파일 이름 변경
cf. 없는 경우는 생성해 주어야 함.
[root@el7 ~]# mv /etc/sysconfig/network-scripts/ifcfg-eno16777736
/etc/sysconfig/network-scripts/ifcfg-eth0
6. [root@el7 ~]# reboot
7. [root@el7 ~]# 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
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP
qlen 1000
link/ether 00:0c:29:21:a6:95 brd ff:ff:ff:ff:ff:ff
인터페이스명 변경
되었음을 확인
- 14. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
네트워크 주소 확인(인터페이스)
ip 주소 확인
[root@el7 /]# ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state U
link/ether 00:0c:29:4e:c3:93 brd ff:ff:ff:ff:ff:ff
inet 192.168.102.131/24 brd 192.168.102.255 scope global eth0
inet6 fe80::20c:29ff:fe4e:c393/64 scope link
valid_lft forever preferred_lft forever
네트워크 통계 정보 확인 ( ip 명령 )
[root@el7 /]# ip -s link show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state U
link/ether 00:0c:29:4e:c3:93 brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
128395 1424 0 0 0 0
TX: bytes packets errors dropped carrier collsns
127536 1000 0 0 0 0
- 15. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
네트워크 주소 추가 (인터페이스)
추가 ip 주소 입력
[root@el7 ~]# ip addr add 10.0.2.50/16 dev eth0
ip 주소 확인
[root@el7 ~]# ip addr
- 16. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
네트워크 주소 (경로 관리)
라우팅 확인
[root@el7 /]# ip route
default via 192.168.102.2 dev eth0 proto static metric 1024
192.168.102.0/24 dev eth0 proto kernel scope link src 192.168.102.131
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1
# ip route [ add | del | change | append | replace ] destination-address
새로운 라우팅 경로 추가
[root@el7 /]# ip route add default via 192.168.1.1
기본 게이트웨이 추가
[root@el7 /]# route add -net default gw 10.0.2.2 dev eth0
ipv6 기본 게이트웨이 추가
[root@el7 /]# ip -6 route add 2001::/24 via 2001:db0::3
- 17. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
네트워크 주소 (경로 관리)
라우팅 테이블 확인
[root@el7 ~]# netstat -nr
main 테이블 확인
[root@el7 ~]# ip route show table main
- 18. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
네트워크 주소 (경로 관리)
시스템에 존재하는 모든 테이블 확인
[root@el7 ~]# ip route show table all
- 19. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
네트워크 주소 확인 (경로 확인)
네트워크 통계 정보 확인 ( ip 명령 )
[root@el7 /]# ping -c 3 192.168.102.2
PING 192.168.102.2 (192.168.102.2) 56(84) bytes of data.
64 bytes from 192.168.102.2: icmp_seq=1 ttl=128 time=0.179 ms
64 bytes from 192.168.102.2: icmp_seq=2 ttl=128 time=0.210 ms
64 bytes from 192.168.102.2: icmp_seq=3 ttl=128 time=0.196 ms
--- 192.168.102.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.179/0.195/0.210/0.012 ms
- 20. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
네트워크 주소 확인 (경로 추적)
traceroute
[root@el7 /]# traceroute www.naver.com
traceroute to www.naver.com (125.209.222.142), 30 hops max, 60 byte packets
1 192.168.102.2 (192.168.102.2) 2.238 ms 2.058 ms 1.960 ms
2 * * *
[root@el7 /]# traceroute -T www.naver.com
traceroute to www.naver.com (125.209.222.141), 30 hops max, 60 byte packets
1 192.168.102.2 (192.168.102.2) 0.698 ms 0.544 ms 0.415 ms
2 125.209.222.141 (125.209.222.141) 21.358 ms 21.326 ms 21.066 ms
tracepath
[root@el7 /]# tracepath www.redhat.com
1: 192.168.102.131 0.130ms pmtu 1500
1: 192.168.102.2 0.577ms
1: 192.168.102.2 0.609ms
- 21. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
네트워크 주소 확인 (포트, 서비스 확인)
netstat
[root@el7 /]# netstat -anp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 2376/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1109/sshd
tcp 0 0 0.0.0.0:56569 0.0.0.0:* LISTEN 1125/rpc.statd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1102/rpcbind
tcp6 0 0 :::22 :::* LISTEN 1109/sshd
ss command
[root@el7 /]# ss -ta
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 5 192.168.122.1:domain *:*
LISTEN 0 128 *:ssh *:*
LISTEN 0 128 *:56569 *:*
LISTEN 0 128 *:sunrpc *:*
ESTAB 0 0 192.168.102.131:ssh 192.168.102.1:52138
LISTEN 0 128 :::ssh :::*
LISTEN 0 128 :::42019 :::*
LISTEN 0 128 :::sunrpc :::*
- 22. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
ss command 활용
로컬시스템에서 listening 하는 TCP 소켓 출력
[root@el7 /]#ss -t -l
모든 UDP 소켓 출력
[root@el7 /]#ss -u -a
모든 SSH 연결 출력
[root@el7 /]#ss -o state established '( dport = :ssh or sport = :ssh )'
X 서버에 연결된 모든 로컬 프로세스 검색
[root@el7 /]#ss -x src /tmp/.X11-unix/*
웹서비스 (http , https) 상태가 FIN-WAIT-1 이고 , 이고 목적지 네트워크가
193.233.7/24 출력
[root@el7 /]#ss -o state fin-wait-1 '( sport = :http or sport = :https )'
dst 193.233.7/24
- 23. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
nmcli 를 이용한 네트워크 관리
모든 연결 목록 확인 ( --active : 활성화된 연결만 출력시)
[root@el7 ~]# nmcli connection show
- 24. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
nmcli 를 이용한 네트워크 관리
연결을 위한 상세한 정보 확인 ( connection ID(name) 지정 )
[root@el7 ~]# nmcli connection show "eno16777736"
노트
정의된 속성과 이름은 nm-settings(5) 매뉴얼 페이지를 참고
- 25. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
nmcli 를 이용한 네트워크 관리
장치 상태 확인
[root@el7 ~]# nmcli dev status
장치 상세 정보 확인
[root@el7 ~]# nmcli dev show eth0
- 26. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
nmcli 를 이용한 새로운 connection 생성
default 이름으로 새로운 연결 추가 (DHCP 를 이용하여 자동연결)
[root@el7 ~]# nmcli connection add con-name "default" type ethernet ifname
eth0
Connection 'default' (3ee33144-5540-4ff8-9b54-511d0237fd67) successfully added.
static 이름으로 새로운 연결 추가 (정적 연결 , 자동 연결 하지 않음)
[root@el7 ~]# nmcli connection add con-name "static" ifname eth0 autoconnect
no type ethernet ip4 192.168.102.20 gw4 192.168.102.2
Connection 'static' (5833257b-738c-4505-ba29-cecac9771793) successfully added.
static 연결로 변경
[root@el7 ~]# nmcli connection up "static"
DHCP 연결로 변경
[root@el7 ~]# nmcli connection up “default"
노트
nmcli dev disconnect DEVNAME 명령 사용시 관리적으로 해당
장치는 비활성화되며 사용 금지되고 , 자동 연결도 금지됨.
- 27. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
nmcli type option
wifi type에는 ssid 같
은 타입이 반드시 입
력되어야 함.
- 28. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
nmcli 를 이용한 기존 connection 수정
static 연결 정보 확인
[root@el7 ~]# nmcli connection show "static"
connection.id: static
connection.uuid: e461fe3c-6666-4fd3-a7d5-3f1c9d366f51
connection.interface-name: eth0
- 29. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
nmcli 를 이용한 기존 connection 수정
autoconnect off
[root@el7 ~]# nmcli connection modify "static" connection.autoconnect no
DNS 서버 지정
[root@el7 ~]# nmcli connection modify "static" ipv4.dns 168.126.63.1
[root@el7 ~]# nmcli connection modify "static" +ipv4.dns 8.8.8.8
ip 및 gateway 입력
[root@el7 ~]# nmcli connection modify "static" ipv4.addresses
"192.168.102.30/24 192.168.102.2"
추가 ip 주소 입력
[root@el7 ~]# nmcli connection modify "static" +ipv4.addresses
"10.0.2.20/16"
노트 nmcli con mod 명령은 구성파일(configuration file)에 저장되지만,.
변경된 사항을 반영하기 위해서는 nmcli con up “static” 명령을 이
용하여 활성화 및 재활성화가 필요.
- 30. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
네트워크 구성파일을 이용한 변경
[root@el7 network-scripts]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
[root@el7 ~]# nmcli connection reload
[root@el7 ~]# nmcli connection down "static"
[root@el7 ~]# nmcli connection up "static"
Connection successfully activated (D-Bus active path:
/org/freedesktop/NetworkManager/ActiveConnection/8)
구성 파일을 직접 편집한 경우
반드시 reload 를 수행해야만
network manager 가 변경 사항
을 반영할 수 있음
- 31. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
network manager-gui
[root@el7 ~]# nm-connection-editor
- 32. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
network manager-tui
[root@el7 ~]# nmtui
- 33. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
제어 센터 GUI
그놈 쉘에서 제공되는 제어 센터
- 34. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
nmcli command summary
command 설명
nmcli dev status 모든 장치 목록 출력
nmcli con show 모든 연결 목록 출력
nmcli con up “<ID>” 연결 활성화
nmcli con down “<ID>” 연결 비활성화,
autoconnect 가 활성화되어 있다면 연결 재시작됨.
nmcli dev dis<DEV> 임시로 autoconnect 를 중지하고 모든 인터페이스를
다운
nmcli net off 모든 관리 인터페이스 중지
nmcli con add …. 새로운 연결 추가
nmcli con mod “<ID>” … 연결 수정
nmcli con del “<ID>” 연결 삭제