Linux network commands
ip
ip command is used to edit and display the configuration of network interfaces, routing, and tunnels. On many Linux systems, it replaces the deprecated ifconfig command.
|
|
netstate
netstate used to display active sockets/ports for each protocol (tcp/ip)
|
|
nmcli
nmcli is a Gnome command tool to control NetworkManager and report network status:
|
|
route
|
|
tracepath
tracepath is used to traces path to a network host discovering MTU along this path. a modern version is traceroute
.
|
|
systemctl restart networking
/etc/init.d/networking restart
or
service NetworkManager stop
ifconfig -a
ifconfig eth0 #check specific network interface
ifconfig eth0 192.168.0.1 #assign static IP address to network interface
ifconfig eth0 netmask 255.255.0.0 #assign netmask
ifconfig docker0 down/up
|
|
Unknown interface enp4s0f2
due TO /etc/network/interfaces
has auto enp4s0f2
line, which always create this network interface , when restart the networking service.
ping hostname with docker0
usually there may be have multi network interfaces(eth0, docker0, bridge..) on a remote host, when ping this remote host with exisiting docker network (docker0
), by default will talk to the docker0, which may not the desired one.
build LAN cluster with office PCs
- setup PC IPs
|
|
192.168.0.1 master
192.168.0.12 worker
if need to update the default hostname to `worker`, can modify `/etc/hostname` file, and reboot.
* ping test :
```script
ping -c 3 master
ping -c 3 worker
- set ssh access(optionally)
sudo apt-get install openssh-server
ssh-keygen -t rsa
# use custmized key
cp rsa_pub.key authorized_key