Networking
Getting Ready
$ vagrant up
$ vagrant ssh
How To do it
From the man pages nmcli, it command‐line tool for controlling NetworkManager.
use help command for nmcli
# nmcli --help
nmcli key option for basic
$ nmcli --help
Usage: nmcli [OPTIONS] OBJECT { COMMAND | help }
OPTIONS
-t[erse] terse output
-p[retty] pretty output
-m[ode] tabular|multiline output mode
-f[ields] <field1,field2,...>|all|common specify fields to output
-e[scape] yes|no escape columns separators in values
-n[ocheck] don't check nmcli and NetworkManager versions
-a[sk] ask for missing parameters
-w[ait] <seconds> set timeout waiting for finishing operations
-v[ersion] show program version
-h[elp] print this help
OBJECT
g[eneral] NetworkManager's general status and operations
n[etworking] overall networking control
r[adio] NetworkManager radio switches
c[onnection] NetworkManager's connections
d[evice] devices managed by NetworkManager
a[gent] NetworkManager secret agent or polkit agent
Configure the Network
View the network
$ ifconfig
For show address
$ ip addr show
For display tcp sockets on the current system
$ ss -it
State Recv-Q Send-Q Local Address:Port Peer Address:Port
ESTAB 0 0 10.0.2.15:ssh 10.0.2.2:57642
cubic rto:201 rtt:1.875/1 ato:65 mss:1460 cwnd:10 send 62.3Mbps rcv_space:14600
$ ss -lt
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 100 127.0.0.1:smtp *:*
LISTEN 0 128 *:ssh *:*
LISTEN 0 100 ::1:smtp :::*
LISTEN 0 128 :::http :::*
LISTEN 0 128 :::ssh :::*
]$ ss -at
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 100 127.0.0.1:smtp *:*
LISTEN 0 128 *:ssh *:*
ESTAB 0 0 10.0.2.15:ssh 10.0.2.2:57642
LISTEN 0 100 ::1:smtp :::*
LISTEN 0 128 :::http :::*
LISTEN 0 128 :::ssh :::*
For Route information
$ ip route
default via 10.0.2.2 dev enp0s3 proto static metric 100
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15 metric 100
For general knowledge for basic
$ nmcli general help
Usage: nmcli general { COMMAND | help }
COMMAND := { status | hostname | permissions | logging }
status
hostname [<hostname>]
permissions
logging [level <log level>] [domains <log domains>]
$ nmcli general logging
LEVEL DOMAINS
INFO PLATFORM,RFKILL,ETHER,WIFI,BT,MB,DHCP4,DHCP6,PPP,IP4,IP6,AUTOIP4,DNS,VPN,SHARING,SUPPLICANT,AGENTS,SETTINGS,SUSPEND,CORE,DEVICE,OLPC,WIMAX,INFINIBAND,FIREWALL,ADSL,BOND,VLAN,BRIDGE,TEAM,CONCHECK,DCB,DISPATCH
$ nmcli general status
STATE CONNECTIVITY WIFI-HW WIFI WWAN-HW WWAN
connected full enabled enabled enabled enabled
$ nmcli device status
DEVICE TYPE STATE CONNECTION
enp0s3 ethernet connected enp0s3
lo loopback unmanaged --
$ nmcli connection show
NAME UUID TYPE DEVICE
enp0s3 3bc773e7-ccb2-47c3-b0a0-a76ca1fb90c9 802-3-ethernet enp0s3
$ nmcli connection show --active
NAME UUID TYPE DEVICE
enp0s3 3bc773e7-ccb2-47c3-b0a0-a76ca1fb90c9 802-3-ethernet enp0s3
Now create network connection
$ sudo nmcli connection add con-name "System-eth0" ifname enp0s3 type ethernet ip4 192.168.26.100/24
Connection 'System-eth0' (0b567d05-54ea-4d09-9da2-a4c2d8c8301c) successfully added.