우분투 20.04 네트워크 관련 명령
2023. 11. 17. 19:06ㆍUbuntu 20.04
안녕하세요 #카트로 입니다.
오늘은 우분투 20.04 버전의 네트워크 관련 명령을 알아 볼게요
- NIC 확인
$ lshw -class network -short
H/W path Device Class Description
========================================================
/7 eth0 network Ethernet interface
/8 eth1 network Ethernet interface
/9 eth2 network Ethernet interface
- ip설정
$ sudo vi /etc/netplan/00-installer-config.yaml
# dhcp 자동할당 설정
# This is the dhcp network config written by 'katro'
network:
ethernets:
eth0:
dhcp4: true
version: 2
# static IP지정 설정
# This is the static network config written by 'karto'
network:
ethernets:
eth0:
addresses:
- 192.168.0.10/24
gateway4: 192.168.0.1
nameservers:
addresses:
- 168.126.63.1
version: 2
- IP설정 적용
$ sudo netplan apply
- IP 정보 확인
$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.179 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::4015:5dff:fe00:4900 prefixlen 64 scopeid 0x20<link>
ether 42:15:5d:00:49:00 txqueuelen 1000 (Ethernet)
RX packets 10533757 bytes 1313945992 (1.3 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 159723 bytes 7972608 (7.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.182 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::4015:5dff:fe00:4902 prefixlen 64 scopeid 0x20<link>
ether 42:15:5d:00:49:02 txqueuelen 1000 (Ethernet)
RX packets 21013 bytes 16213810 (16.2 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3413 bytes 380594 (380.5 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 1138 bytes 122909 (122.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1138 bytes 122909 (122.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0