Manage netowork on Ubuntu 20.04.2 LTS
1. Bringing interfaces up/down
Two methods can be used to bring interfaces up or down.
a. Using "ip"
Usage:
# ip link set dev <interface> up
# ip link set dev <interface> down
Example:
# ip link set dev eth0 up
# ip link set dev eth0 down
b. Using "ifconfig"
Usage:
# /sbin/ifconfig <interface> up
# /sbin/ifconfig <interface> down
Example:
# /sbin/ifconfig eth0 up
# /sbin/ifconfig eth0 down
출처: https://tldp.org/HOWTO/Linux+IPv6-HOWTO/ch05s02.html
2. Set Static IP Address
Edit "/etc/netplan/00-installer-config.yaml"
e.g.)
a. check interface devices
# ls /sys/class/net
# ip link
b. set address
# vi /etc/netplan/00-installer-config.yaml
----------------------------
# This is the network config written by 'subiquity'
network:
ethernets:
ens33: # device name
# dhcp4: true # remove or annotate
addresses: [192.168.1.5/24] # Set IP Address, Need to use CIDR notation
gateway4: 192.168.1.254 # Set Gateway address
nameservers:
addresses: [168.168.1.1, 8.8.8.8] # Set name server address, separate ','.
version: 2
----------------------------
c. apply
# netplan apply
출처:
https://enowy.tistory.com/33
https://feelsogoodcamp.tistory.com/35