- 先切換身份成為 root ,才有辦法做管理!
# su -
- 觀察目前的連線界面有哪些
# nmcli connection show
NAME UUID TYPE DEVICE
virbr0-nic 3b650a23-c58f-4116-9351-195e6895c969 generic virbr0-nic
virbr0 08f7cf02-986a-47de-844f-4176b1694288 bridge virbr0
eth0 5d4419c4-ca15-468d-96fd-b6a4942d847d 802-3-ethernet eth0
上面的那個 NAME 的項目,就是實際的網路連線界面,而後面的 DEVICE 則是實體的網卡名稱。
- 觀察連線界面的實際設定值
# nmcli connection show eth0
connection.id: eth0
connection.uuid: 5d4419c4-ca15-468d-96fd-b6a4942d847d
connection.interface-name: eth0
connection.type: 802-3-ethernet
connection.autoconnect: yes
connection.autoconnect-priority: 0
connection.timestamp: 1475580506
connection.read-only: no
connection.permissions:
connection.zone: --
connection.master: --
connection.slave-type: --
connection.autoconnect-slaves: -1 (default)
connection.secondaries:
connection.gateway-ping-timeout: 0
connection.metered: 不明
802-3-ethernet.port: --
802-3-ethernet.speed: 0
802-3-ethernet.duplex: --
802-3-ethernet.auto-negotiate: yes
802-3-ethernet.mac-address: --
802-3-ethernet.cloned-mac-address: --
802-3-ethernet.mac-address-blacklist:
802-3-ethernet.mtu: auto
802-3-ethernet.s390-subchannels:
802-3-ethernet.s390-nettype: --
802-3-ethernet.s390-options:
802-3-ethernet.wake-on-lan: 1 (default)
802-3-ethernet.wake-on-lan-password: --
ipv4.method: manual
ipv4.dns: 168.95.1.1
ipv4.dns-search:
ipv4.addresses: 172.20.0.100/24
ipv4.gateway: 172.20.0.254
ipv4.routes:
ipv4.route-metric: -1
ipv4.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.never-default: no
ipv4.may-fail: yes
ipv6.method: auto
ipv6.dns:
ipv6.dns-search:
ipv6.addresses:
ipv6.gateway: --
ipv6.routes:
ipv6.route-metric: -1
ipv6.ignore-auto-routes: no
ipv6.ignore-auto-dns: no
ipv6.never-default: no
ipv6.may-fail: yes
ipv6.ip6-privacy: -1(不明)
ipv6.dhcp-send-hostname: yes
ipv6.dhcp-hostname: --
GENERAL.NAME: eth0
GENERAL.UUID: 5d4419c4-ca15-468d-96fd-b6a4942d847d
GENERAL.DEVICES: eth0
GENERAL.STATE: 已啟用
GENERAL.DEFAULT: 是
GENERAL.DEFAULT6: 否
GENERAL.VPN: 否
GENERAL.ZONE: --
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/0
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/0
GENERAL.SPEC-OBJECT: /
GENERAL.MASTER-PATH: --
IP4.ADDRESS[1]: 172.20.0.100/24
IP4.GATEWAY: 172.20.0.254
IP4.DNS[1]: 168.95.1.1
IP6.ADDRESS[1]: fe80::5054:ff:fe42:862e/64
IP6.GATEWAY:
小寫的部份為設定值,大寫的部份為目前實際運作中的情況!
- 實際設定 IP 位址參數的方法
nmcli connection [ modify eth0 ] [ connection.autoconnect yes ] [ ipv4.method manual ]
[ ipv4.addresses IP/NETMASK ] [ ipv4.gateway GWIP ] [ ipv4.dns DNSIP ]
- 練習:
- 你的內部網路為 10.0.0.*/24 (* 為你的學號尾數)
- 你的 Gateway 為 10.0.0.254
- DNS Server IP 使用 120.114.100.1 及 120.114.150.1
- 檢測流程:
- 檢查 IP/netmask 可以使用『 ifconfig 』、『 ip addr show 』、『 nmcli connection show eth0 』
- 檢查 gateway 可以使用『 route -n 』、『 nmcli connection show eth0 』
- 檢查你的主機到 gateway 之間的連線,可以使用 ping
- 檢查 DNS 有沒有運作,可以使用 dig www.google.com
- 可以使用 ping 168.95.1.1 對中華電信最大的 DNS 伺服器進行連線測試
- 上述流程每一步都要成功!