centos 7 固定區域網IP

2021-10-02 10:54:11 字數 2332 閱讀 4682

昨天搭建了flink on yarn的環境,一切配置妥當之後執行了乙個example,沒毛病。今天開機再提交job到yarn時發現集群跑不起來了,看了一下ip才發現虛擬機器的ip變了,今天更改了一下配置將ip固定了。

1) 首先檢視對應機器的ip是什麼,執行ifconfg

$ ifconfig

ens33: flags=4163 mtu 1500

inet 192.168.0.111 netmask 255.255.255.0 broadcast 192.168.0.255

inet6 fe80::4f32:1998:79dd:d454 prefixlen 64 scopeid 0x20

inet6 fe80::8485:ccac:c378:5e98 prefixlen 64 scopeid 0x20

inet6 fe80::ecc2:2da1:1ea4:9660 prefixlen 64 scopeid 0x20

ether 00:0c:29:c3:bb:84 txqueuelen 1000 (ethernet)

rx packets 16236 bytes 2583626 (2.4 mib)

rx errors 0 dropped 0 overruns 0 frame 0

tx packets 106083 bytes 252342720 (240.6 mib)

tx errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73 mtu 65536

inet 127.0.0.1 netmask 255.0.0.0

inet6 ::1 prefixlen 128 scopeid 0x10

loop txqueuelen 1000 (local loopback)

rx packets 16389 bytes 284411027 (271.2 mib)

rx errors 0 dropped 0 overruns 0 frame 0

tx packets 16389 bytes 284411027 (271.2 mib)

tx errors 0 dropped 0 overruns 0 carrier 0 collisions 0

veth5c3c554: flags=4163 mtu 1500

inet6 fe80::248d:3aff:febb:b0b4 prefixlen 64 scopeid 0x20

ether 26:8d:3a:bb:b0:b4 txqueuelen 0 (ethernet)

rx packets 0 bytes 0 (0.0 b)

rx errors 0 dropped 0 overruns 0 frame 0

tx packets 16 bytes 1312 (1.2 kib)

tx errors 0 dropped 0 overruns 0 carrier 0 collisions 0

#gateway

$ netstat -rn

kernel ip routing table

destination gateway genmask flags mss window irtt iface

0.0.0.0 192.168.0.1 0.0.0.0 ug 0 0 0 ens33

#dns

$ cat /etc/resolv.conf

# generated by networkmanager

nameserver 192.168.1.1

3)得到以上資訊後,更改網路配置檔案:

$ vim /etc/sysconfig/network-scripts/ifcfg-ens33

## 加入以下資訊

ipaddr=192.168.0.111

gateway=192.168.0.1

netmask=255.255.255.0

dns1=192.168.1.1

同時要把bootproto="dhcp"變更為bootproto="static"

4)重啟網路:

service network restart

restarting network (via systemctl): [ ok ]

centos7建立區域網yum源

如果centos伺服器處在內網環境中時,如果缺少依賴手動安裝那麼會非常麻煩,要花費很多時間來尋找rpm包,現在如果搭建本地的yum源,就非常方便了,如果搭建http的,那麼區域網內其他伺服器就都可以使用了,使用yum源首先需要乙個centos安裝映象,這裡是 centos 7 x86 64 1708...

centos7設定固定IP

centos7設定固定ip 新增修改部分為以下帶 注釋的項 虛擬機器選擇橋接模式 bootproto static 改為static defroute yes ipv4 failure fatal no ipv6init yes ipv6 autoconf yes ipv6 defroute yes...

centos7固定ip位址

說下我的環境 1 oracle vm virtualbox 2 centos7 注 這裡說一下本地安裝完用xshell連線的時候一定要把防火牆關掉喲,不然是連線不上的,centos7的防火牆命令可以看我之前的文章 安裝完成之後,首先檢視當前ip位址 然後進入 etc sysconfig networ...