Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


ip linkLink
show the interface

ip link show 

ip link show ens33

bring the interface up

ip link set dev ens33 up




ip addrLink

ip addr

ip addr show ens33





...

Private IP addresshttps://linuxhandbook.com/find-ip-address/

hostname -I

nmcli -p device show


Public IP addresshttps://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


Code Block
titledhcp
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

sudo more /etc/sysconfig/network-scripts/ifcfg-ens18


Code Block
titlestatic IP address
sudo vi /etc/sysconfig/network-scripts/ifcfg-ens18




UbuntuConfig file

renderer: networkd

renderer: NetworkManager
( not installed by default )


Raspberry + dual IP addressdebian

more /etc/network/interfaces


Code Block
titlenetwork/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
vi /etc/netplan/xx--installer-config.yaml
!!! all the files in the list will be used

sudo netplan apply
sudo netplan get   ( get the config information )


Code Block
titlenetplan config file YAML
collapsetrue
more /etc/netplan/10-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  version: 2
  renderer: networkd
  ethernets:
    ens33:
      dhcp4: true
    ens34:
      dhcp4: no
      addresses: [10.1.4.10/24]
      gateway4: 10.1.4.2


Network Manager

DHCP
/etc/network/interfaces
auto eth1
  iface eth1 inet dhcp

sudo systemctl restart networking
Static




...