본문 바로가기

라즈베리파이/Setting

Raspberry Pi 네트워크 아이피 고정 명령어

반응형
sudo nmcli c show

eth0 : 유선랜 아이피 변경

위에서 NAME으로 되어있는 이름으로 지정해서 설정 하면 된다. 

Wired connection 1  =  eth0

#!/bin/bash

# Verify and take down the connection
sudo nmcli c down 'Wired connection 1'

# Modify the connection settings
sudo nmcli c mod 'Wired connection 1' ipv4.addresses 192.168.0.20/24 ipv4.method manual
sudo nmcli con mod 'Wired connection 1' ipv4.gateway 192.168.0.1
sudo nmcli con mod 'Wired connection 1' ipv4.dns "168.126.63.1"

# Save the connection settings
sudo nmcli c reload
sudo nmcli c up 'Wired connection 1'

# Restart Network Manager service
sudo systemctl restart NetworkManager

위에 내용을 network.sh로 저장

chmod +x netowrk.sh로 실행 권한 설정후

sudo sh network.sh로 실행하면된다.

'라즈베리파이 > Setting' 카테고리의 다른 글

Raspberry Pi 4 - 방화벽 설정 - 포트 열기  (0) 2023.08.15