If you can't read please download the document
Upload
suk-kim
View
4.129
Download
13
Embed Size (px)
Citation preview
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Enterprise Linkx 7 New FeatureRHEL , OEL , CentOS , Fedora
Suk Kim , Oracle ACE Director
Nobreak Senior managed Consultant
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
. .
( , , )
.
Contacts : [email protected]
NetworkManager nmcli , network manager
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
( nick : )
) ( Oracle ACE Director )
) /
) IT
)
)
)
) IT
Network Configuration
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 ]
# system-config-network netstat -nr route
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Service ( NetworkManager ) NM_CONTROLLED=no
[root@el7 ~]# systemctl enable network.servicenetwork.service is not a native service, redirecting to /sbin/chkconfig.Executing /sbin/chkconfig network onThe unit files have no [Install] section. They are not meant to be enabledusing 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.servicerm '/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'
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
network manager
[root@el7 ~]# yum -y install NetworkManager
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
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
RHEL7 / OEL 7 1.
[root@el7 /]# ip addr
1: lo: 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: mtu 1500 qdisc pfifo_faststate UP qlen 1000 link/ether 00:0c:29:21:a6:95 brd ff:ff:ff:ff:ff:ff
3: virbr0: 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:Etherneto : on board
http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-net_id.c#n20
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=konet.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
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
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: 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: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:21:a6:95 brd ff:ff:ff:ff:ff:ff
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
()
ip
[root@el7 /]# ip addr show eth02: eth0: mtu 1500 qdisc pfifo_faststate U
link/ether 00:0c:29:4e:c3:93 brd ff:ff:ff:ff:ff:ffinet 192.168.102.131/24 brd 192.168.102.255 scope global eth0inet6 fe80::20c:29ff:fe4e:c393/64 scope link
valid_lft forever preferred_lft forever
( ip )
[root@el7 /]# ip -s link show eth02: eth0: mtu 1500 qdisc pfifo_fast state U
link/ether 00:0c:29:4e:c3:93 brd ff:ff:ff:ff:ff:ffRX: bytes packets errors dropped overrun mcast128395 1424 0 0 0 0 TX: bytes packets errors dropped carrier collsns127536 1000 0 0 0 0
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
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
( )
[root@el7 /]# ip routedefault 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
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
( )
[root@el7 ~]# netstat -nr
main
[root@el7 ~]# ip route show table main
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
( )
[root@el7 ~]# ip route show table all
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
( )
( ip )
[root@el7 /]# ping -c 3 192.168.102.2PING 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 ms64 bytes from 192.168.102.2: icmp_seq=2 ttl=128 time=0.210 ms64 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 2001msrtt min/avg/max/mdev = 0.179/0.195/0.210/0.012 ms
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
( )
traceroute
[root@el7 /]# traceroute www.naver.comtraceroute to www.naver.com (125.209.222.142), 30 hops max, 60 byte packets1 192.168.102.2 (192.168.102.2) 2.238 ms 2.058 ms 1.960 ms2 * * *[root@el7 /]# traceroute -T www.naver.comtraceroute to www.naver.com (125.209.222.141), 30 hops max, 60 byte packets1 192.168.102.2 (192.168.102.2) 0.698 ms 0.544 ms 0.415 ms2 125.209.222.141 (125.209.222.141) 21.358 ms 21.326 ms 21.066 ms
tracepath
[root@el7 /]# tracepath www.redhat.com1: 192.168.102.131 0.130ms pmtu 15001: 192.168.102.2 0.577ms 1: 192.168.102.2 0.609ms
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
(, )
netstat
[root@el7 /]# netstat -anpActive 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/dnsmasqtcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1109/sshdtcp 0 0 0.0.0.0:56569 0.0.0.0:* LISTEN 1125/rpc.statdtcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1102/rpcbindtcp6 0 0 :::22 :::* LISTEN 1109/sshd
ss command
[root@el7 /]# ss -taState Recv-Q Send-Q Local Address:Port Peer Address:PortLISTEN 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 :::*
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
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
nmcli
( --active : )
[root@el7 ~]# nmcli connection show
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)
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
nmcli
[root@el7 ~]# nmcli dev status
[root@el7 ~]# nmcli dev show eth0
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 ifnameeth0 Connection 'default' (3ee33144-5540-4ff8-9b54-511d0237fd67) successfully added.
static ( , )
[root@el7 ~]# nmcli connection add con-name "static" ifname eth0 autoconnectno type ethernet ip4 192.168.102.20 gw4 192.168.102.2Connection '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
, .
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
nmcli type option
wifi type ssid
.
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
nmcli connection
static
[root@el7 ~]# nmcli connection show "static" connection.id: staticconnection.uuid: e461fe3c-6666-4fd3-a7d5-3f1c9d366f51connection.interface-name: eth0
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 .
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
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
network manager-gui
[root@el7 ~]# nm-connection-editor
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
network manager-tui
[root@el7 ~]# nmtui
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
GUI
Copyright 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
nmcli command summarycommand
nmcli dev status
nmcli con show
nmcli con up
nmcli con down , autoconnect .
nmcli dev dis autoconnect
nmcli net off
nmcli con add .
nmcli con mod
nmcli con del
1 Network Configuration network manager network manager RHEL7 / OEL 7 RHEL7 / OEL 7 RHEL7 / OEL 7 RHEL7 / OEL 7 () () ( ) ( ) ( ) ( ) ( ) (, )ss command nmcli nmcli nmcli nmcli connection nmcli type optionnmcli connection nmcli connection network manager-guinetwork manager-tui GUInmcli command summary