728x90
CentOS 7에서 고정 IP를 설정하는 방법
테스트 환경
cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
ifconfig 명령 설치
yum install -y net-tools
ifconfig 명령으로 인터페이스 확인
ifconfig
$ ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.62 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::812d:fb4:4b81:82c5 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:77:8e:c3 txqueuelen 1000 (Ethernet)
RX packets 19447 bytes 27175941 (25.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2165 bytes 230943 (225.5 KiB)
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 4 bytes 336 (336.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 336 (336.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ip a
ifcfg-enp0s3 설정 확인
vim /etc/sysconfig/network-scripts/ifcfg-enp0s3
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=98fd22b9-ff76-44a9-b81d-4d6b532271cd
DEVICE=enp0s3
ONBOOT=yes
고정 ip 설정
BOOTPROTO=static
IPADDR=192.168.0.62
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
vim /etc/sysconfig/network-scripts/ifcfg-enp0s3
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=98fd22b9-ff76-44a9-b81d-4d6b532271cd
DEVICE=enp0s3
ONBOOT=yes
IPADDR=192.168.0.62
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
728x90
nmtui 명령으로 편집
nmtui edit enp0s3
network 재시작
systemctl restart network
resolv.conf 설정
cat <<EOF > /etc/resolv.conf
nameserver 168.126.63.1
nameserver 8.8.8.8
nameserver 1.1.1.1
EOF
추가 nic card 상세 정보 확인
ethtool enp0s3
$ ethtool enp0s3
Settings for enp0s3:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
MDI-X: off (auto)
Supports Wake-on: umbg
Wake-on: d
Current message level: 0x00000007 (7)
drv probe link
Link detected: yes
참고URL
- 리눅스 network configuration : https://scbyun.com/95
- 우분투 22.04 systemd-resolved 데몬(서비스) 비활성화 : https://scbyun.com/1248
728x90
'리눅스' 카테고리의 다른 글
CentOS 7에서 vsftpd 데몬을 추가 구성하는 방법 (0) | 2022.12.12 |
---|---|
CentOS 7에서 네트워크 구성을 설정하는 방법(network configuration) (0) | 2022.12.12 |
[draft] CentOS 7에서 yum 저장소를 변경하는 방법 (0) | 2022.12.12 |
[draft] systemd 명령어 (0) | 2022.12.11 |
우분투에서 TFTP 서버를 구축하는 방법 (0) | 2022.12.11 |