route →ip r(route)
netstat →ss
netstat -i →ip -s link
arp →ip n(neighbor)
1) HOST名を設定するには、
# nmcli general hostname XXXXXXXX
・確認
# nmcli general hostname
# nmcli connection modify enp0s25 connection.autoconnect yes
確認は、
#
切断状態からは、
nmcli connection delete enp1s0
nmcli connection add ifname enp1s0 con-name enp0s3 type ethernet autoconnect yes ipv4.method auto
# yum -y install telnet telnet-server
# systemctl enable telnet.socket ←自動起動をON
# systemctl start telnet.socket
# firewall-cmd –permanent –add-rich-rule='rule family="ipv4" source address="192.168.24.0/24" service name="telnet" log prefix="telnet" level="info" limit value="1/m" accept'
# firewall-cmd --reload
GUIツール
# firewall -config
【VLANを作る】
# nmcli connection add type ethernet ifname enp0s3 con-name enp0s3
# nmcli c add type vlan ifname vlan11 con-name vlan-vlan11 dev enp0s3 id 11
# nmcli c mod vlan-vlan11 ipv4.method manual ipv4.address 192.168.1.101/24
# nmcli c u vlan-vlan11
※インターフェースの命名規則
* Two character prefixes based on the type of interface:
* en -- ethernet
* sl -- serial line IP (slip)
* wl -- wlan
* ww -- wwan
*
* Type of names:
* b<number> -- BCMA bus core number
* ccw<name> -- CCW bus group name
* o<index>[d<dev_port>] -- on-board device index number
* s<slot>[f<function>][d<dev_port>] -- hotplug slot index number
* x<MAC> -- MAC address
* [P<domain>]p<bus>s<slot>[f<function>][d<dev_port>]
* -- PCI geographical location
* [P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]
* -- USB port number chain
【例】
# nmcli general hostname ホスト名
# nmcli c mod eth0 ipv4.method manual ipv4.addresses 192.168.1.100/24
# nmcli c mod eth0 ipv4.gateway 192.168.1.1
# nmcli c mod eth0 ipv4.dns 192.168.1.1
# nmcli c mod eth0 connection.autoconnect yes # 起動時自動接続
# nmcli con mod eth0 ipv4.may-fail no # IP4 only
# nmcli con mod eth0 ipv6.method ignore # IPV6無効
# nmcli con up eth0
# systemctl restart network.service
# systemctl stop guacd
# systemctl stop zabbix-agent
# systemctl stop zabbix-server
# systemctl stop httpd
# systemctl stop tomcat
# systemctl start tomcat
# systemctl start httpd
# systemctl start zabbix-server
# systemctl start zabbix-agent
# systemctl start guacd
# systemctl list-unit-files -t service
# nmcli -p connection show
# ip a
# nmcli general hostname XXXXXXXX
・確認
# nmcli general hostname
# hostname
# cat /etc/hostnmame
2) デバイスを確認
# nmcli device
DEVICE TYPE STATE CONNECTION
ens3 ethernet 接続済み VLAN100
virbr0 bridge 接続済み (外部) virbr0
lo loopback 管理無し --
virbr0-nic tun 管理無し --
# nmcli connection
NAME UUID TYPE DEVICE
vlan100 74d76747-f9f6-4bb2-b85a-b45b211635da ethernet ens3
virbr0 606cf9e5-c995-4ae7-98cf-164f9e4f406f bridge virbr0
enp1s0 3f028be9-84bd-462e-be1a-3443a2f69d75 ethernet --
# nmcli device show [device]
3) OS起動時にネットワーク自動接続するには、
# nmcli connection modify enp0s25 connection.autoconnect yes
確認は、
#
nmcli -p connection show enp0s25
4) 固定IPを使うには、
nmcli connection delete enp1s0
nmcli connection add ifname enp1s0 con-name enp0s3 type ethernet autoconnect yes ipv4.method auto
# nmcli connection modify で設定変更
nmcli connection add ifname enp0s3 con-name enp0s3 type ethernet
nmcli connection modify enp0s3 autoconnect yes
nmcli connection modify enp0s3 ipv4.method auto
# nmcli device /* デバイス状態確認 */
# nmcli device show eno1 /* デバイス設定確認 */
# nmcli connection modify eno1 ipv4.method manual
nmcli connection up enp1s0
# nmcli connection modify vlan100 ipv4.method manual
# nmcli connection modify vlan100 ipv4.addresses 192.168.25.199/24
# nmcli connection modify vlan100 ipv4.gateway 192.168.25.254
# nmcli connection modify vlan100 ipv4.dns 192.168.25.254
5) インターフェースを再起動するには、
# nmcli device
# nmcli connection down vlan100
# nmcli connection up vlan100
6) これらの設定を有効にするには、
#
systemctl restart NetworkManager
7) 動的IPを使うには
# nmcli connection modify vlan100 ipv4.method auto
# nmcli connection modify vlan100 ipv4.connection.autoconnect yes
8) スタティックルートを設定するには
# nmcli connection modify vlan100 +ipv4.routes "192.168.25.0/24 192.168.1.220"
【まとめ】
# nmcli general hostname
# nmcli general hostname XXXXXXXX /* ホスト名設定 */# nmcli device /* デバイス状態確認 */
# nmcli device show eno1 /* デバイス設定確認 */
# nmcli connection modify eno1 ipv4.method manual
# nmcli connection modify eno1 ipv4.addresses 192.168.1.199/24
# nmcli connection modify eno1 ipv4.gateway 192.168.1.254
# nmcli connection modify eno1 ipv4.dns 192.168.1.254
# nmcli connection down eno1
# nmcli connection up eno1
# nmcli connection up eno1
# nmcli connection modify eno1 connection.autoconnect yes
# systemctl restart NetworkManager /* 全ネットワーク再起動 */
【まとめ2】
# nmcli device
# nmcli connection
nmcli d
nmcli c
nmcli c delete internet
nmcli c delete vlan100
nmcli general hostname zabbix
nmcli c add type ethernet ifname enp1s0 con-name "internet" ethernet.mtu 1500
nmcli c mod internet ipv4.method auto
nmcli c mod internet connection.autoconnect yes
nmcli c up internet
nmcli c add type ethernet ifname enp7s0 con-name "vlan100" ethernet.mtu 1500
nmcli c mod vlan100 ipv4.addresses 192.168.100.254/24
nmcli c mod vlan100 ipv4.method manual
#nmcli c mod vlan100 ipv4.gateway 192.168.100.254
#nmcli c mod vlan100 ipv4.dns 8.8.8.8
#nmcli c mod vlan100 +ipv4.routes "172.18.0.0/16 192.168.100.1"
nmcli c mod vlan100 connection.autoconnect yes
nmcli c up vlan100
# systemctl daemon-reload
# systemctl restart NetworkManager
( # systemctl restart network.service )
簡易GUIツールで設定するには、
#ip addr show #nmtui <- ツール起動 メニューに沿って設定 #systemctl restart network.service (アドレスの確認) #ip addr show
4) ルーティングを設定するには、
# route add -net 128.1.1.0 netmask 255.255.255.0 gw 192.168.1.1
# 恒久的に設定するには
# vi /etc/sysconfig/network-scripts/route-ens33
128.1.1.0/24 via 192.168.1.1
ip route add 128.1.1.0/24 via 192.168.1.1
5) 【telnetdインストール】# yum -y install telnet telnet-server
# systemctl enable telnet.socket ←自動起動をON
# systemctl start telnet.socket
# firewall-cmd –permanent –add-rich-rule='rule family="ipv4" source address="192.168.24.0/24" service name="telnet" log prefix="telnet" level="info" limit value="1/m" accept'
# firewall-cmd --reload
GUIツール
# firewall -config
【VLANを作る】
# nmcli connection add type ethernet ifname enp0s3 con-name enp0s3
# nmcli c add type vlan ifname vlan11 con-name vlan-vlan11 dev enp0s3 id 11
# nmcli c mod vlan-vlan11 ipv4.method manual ipv4.address 192.168.1.101/24
# nmcli c u vlan-vlan11
※インターフェースの命名規則
* Two character prefixes based on the type of interface:
* en -- ethernet
* sl -- serial line IP (slip)
* wl -- wlan
* ww -- wwan
*
* Type of names:
* b<number> -- BCMA bus core number
* ccw<name> -- CCW bus group name
* o<index>[d<dev_port>] -- on-board device index number
* s<slot>[f<function>][d<dev_port>] -- hotplug slot index number
* x<MAC> -- MAC address
* [P<domain>]p<bus>s<slot>[f<function>][d<dev_port>]
* -- PCI geographical location
* [P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]
* -- USB port number chain
【例】
# nmcli general hostname ホスト名
# nmcli c mod eth0 ipv4.method manual ipv4.addresses 192.168.1.100/24
# nmcli c mod eth0 ipv4.gateway 192.168.1.1
# nmcli c mod eth0 ipv4.dns 192.168.1.1
# nmcli c mod eth0 connection.autoconnect yes # 起動時自動接続
# nmcli con mod eth0 ipv4.may-fail no # IP4 only
# nmcli con mod eth0 ipv6.method ignore # IPV6無効
# nmcli con up eth0
# systemctl restart network.service
# systemctl stop guacd
# systemctl stop zabbix-agent
# systemctl stop zabbix-server
# systemctl stop httpd
# systemctl stop tomcat
# systemctl start tomcat
# systemctl start httpd
# systemctl start zabbix-server
# systemctl start zabbix-agent
# systemctl start guacd
# systemctl list-unit-files -t service
# nmcli -p connection show
# ip a
0 件のコメント:
コメントを投稿