linux修改IP為靜態IP
系統版本 rhel7.2
1、首先ifconfig
看一下我們的裝置名字,我查到的是eno16777736
,ip是192.168.1.7
[sam@yl 桌面]$ ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.7 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::20c:29ff:febc:1dfe prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:bc:1d:fe txqueuelen 1000 (Ethernet)
RX packets 52 bytes 9322 (9.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 91 bytes 10275 (10.0 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 0 (Local Loopback)
RX packets 4 bytes 340 (340.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 340 (340.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:4a:d0:88 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2、修改我們的配置檔案(首先要確定有許可權,我是直接su切換到root下修改的)
:
[root@yl 桌面]# vim /etc/sysconfig/network-scripts/ifcfg-eno16777736
TYPE="Ethernet"
BOOTPROTO="dhcp"
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="eno16777736"
UUID="402edb11-e974-4fa5-95b1-1718af166586"
DEVICE="eno16777736"
ONBOOT="yes"
修改BOOTPROTO為static或者none,這倆都是指定ip為靜態的。
然後在下面新增IP、子網掩碼、閘道器、DNS
IPADDR=192.168.1.15
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=114.114.114.114
3、重啟(三種方式總有一款適合你)
:
1、service network restart
2、systemctl restart NetworkManager
3、先關閉再啟動
ifdown eno16777736
ifup eno16777736
動態獲取IP :
BOOTPROTO則改為dhcp
然後去掉IP、子網掩碼、閘道器、DNS
相關文章
- linux靜態ip 配置Linux
- linux靜態IP配置Linux
- Linux中配置靜態IPLinux
- ubuntu修改mac地址及配置靜態ipUbuntuMac
- Linux靜態Ip配置失敗Linux
- Linux下設定靜態IP和獲取動態IP的方法Linux
- Linux伺服器配置靜態IPLinux伺服器
- Linux下設定靜態IP地址Linux
- 【002】Linux配置靜態ip地址Linux
- CentOS配置靜態IPCentOS
- 動態IP與靜態IP的主要區別
- 海外靜態代理IP如何搭建?靜態IP有什麼好處?
- 動態IP和靜態IP有什麼區別?
- Linux修改IPLinux
- linux靜態ip的ens33部署LinuxS3
- Linux Mint 20 設定靜態IP地址Linux
- Liunx配置靜態ip VMware
- ubuntu 下配置靜態IPUbuntu
- 【科普】靜態IP和動態IP有什麼區別?
- 【普】靜態IP和動態IP有什麼區別?
- 【知識分享】動態ip和靜態ip的區別
- 靜態IP與動態IP有什麼區別?海外代理IP詳解
- 購買ip為什麼要選擇靜態住宅ip?合適的靜態住宅代理如何尋找?
- Linux虛擬機器設定靜態IPLinux虛擬機
- Linux靜態IP設定(ipconfig命令)Linux
- Linux下修改IPLinux
- linux修改IP地址Linux
- Ubuntu裡怎樣設定靜態IP?Ubuntu中設定靜態IP的方法Ubuntu
- 靜態住宅IP與動態住宅IP有什麼區別?
- ubuntu 配置靜態IP 和 DNSUbuntuDNS
- Ubuntu 16.04 配置靜態 ipUbuntu
- centos 7 設定靜態ipCentOS
- OpenSUSE的靜態IP設定
- LINUX centos7.6修改靜態IP與配置引數NM_CONTROLLEDLinuxCentOS
- 系列TCP/IP協議-靜態IP選路(007)TCP協議
- Python3.10動態修改Windows系統(win10/win11)本地IP地址(靜態IP)PythonWindowsWin10
- 如何獲取高質量的靜態住宅ip,建立自己的靜態ip代理池?
- 海外動態IP和海外靜態IP:哪種更適合您?