ip link | Link |
---|---|
show the interface | ip link show ip link show ens33 |
bring the interface up | ip link set dev ens33 up |
ip addr | Link |
ip addr ip addr show ens33 | |
Centos | ip addr add 192.168.1.1/24 dev eth0 |
Private IP address | https://linuxhandbook.com/find-ip-address/ |
---|---|
| |
| |
Public IP address | https://www.tutorialspoint.com/find-my-public-ip-address-from-linux-command-line |
curl ifconfig.me | |
Centos | config file |
dhcp | sudo more /etc/sysconfig/network-scripts/ifcfg-ens18 dhcp sudo vi /etc/sysconfig/network-scripts/ifcfg-ens18 BOOTPROTO=dhcp DEFROUTE=yes DEVICE=ens18 DHCPV6C=no MTU=1500 NM_CONTROLLED=yes ONBOOT=yes PEERDNS=yes TYPE=Ethernet USERCTL=no |
Static IP address | network-scripts ifcfg-ens ifcfg-eth |
sudo more /etc/sysconfig/network-scripts/ifcfg-ens18 static IP address sudo vi /etc/sysconfig/network-scripts/ifcfg-ens18 | |
systemctl restart network.service | |
Ubuntu | Config file |
renderer: networkd | |
renderer: NetworkManager ( not installed by default ) | |
Raspberry + dual IP address | debian |
more /etc/network/interfaces network/interfaces root@boxed:/var/www/html# more /etc/network/interfaces # interfaces(5) file used by ifup(8) and ifdown(8) # Please note that this file is written to be used with dhcpcd # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf' # Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d auto eth0 iface eth0 inet dhcp auto eth0:1 allow-hotplug eth0:1 iface eth0 inet static address 192.168.226.101 netmask 255.255.255.0 gateway 192.168.226.1 dns-maneservers 8.8.8.8 | |
networkd | |
netplan |
|
Network Manager |
|
DHCP | /etc/network/interfaces auto eth1 iface eth1 inet dhcp sudo systemctl restart networking |
Static | network interface # The primary network interface iface eth0 inet manual auto pnet0 iface pnet0 inet static pre-up ip link set dev eth0 up address 192.168.0.115 network 192.168.0.0 netmask 255.255.255.0 gateway 192.168.0.1 dns-nameserver 8.8.8.8 dns-search example.com bridge_ports eth0 bridge_stp off |