Linux 配置靜態ip位址模板整理

2021-09-23 22:25:20 字數 1380 閱讀 8277

配置檔案位置:/etc/sysconfig/network-scripts/ifcfg-eth0

device=eth0 網絡卡的名字

hwaddr=00:0c:29:90:89:d9 hwaddr hardware address 硬體位址 mac位址

type=ethernet 網路型別 乙太網

uuid=ae779ae6-044d-43d5-a33b-48c89e8de10e #uuid 做到系統中獨一無二。

onboot=yes boot on ? 在開機或重啟網絡卡的時候是否啟動網絡卡

nm_controlled=yes 是否受network程式管理

bootproto=none 網絡卡是如何獲取到ip位址 網絡卡獲取ip位址的方式

a. dhcp 自動獲取ip位址

b. none 固定的ip位址

c. static 固定的ip位址

ipaddr=10.0.0.100 ipaddr ip位址

netmask=255.255.255.0 子網掩碼 決定這個區域網中最多有多少臺機器

gateway=10.0.0.2 閘道器 整個大樓的大門

userctl=no 普通使用者是否能控制網絡卡

/etc/resolv.conf 配置dns 網絡卡配置檔案的dns優先於/etc/resolv.conf

dns 網域名稱解析器 阿里的網域名稱解析器:223.5.5.5 223.6.6.6

重啟網絡卡 /etc/init.d/network restart

測試 ping 192.168.102.2 (本地)

測試 ping www.baidu.com

device="ens33"     --網絡卡名

name='ens33'

bootproto="static" --靜態dhcp 為自動獲取

type="ethernet" --網路型別

ipaddr="192.168.41.105" --ip

#ipaddr1="192.168.41.106" --ip #第二個ip

netmark="255.255.255.0" --子網掩碼 或者是prefix=24

#prefix=24 #等同於子網掩碼

gateway="192.168.41.2" --閘道器

dns1="8.8.8.8"

dns2="8.8.4.4"

onboot="yes"

Linux 配置靜態IP位址的方法

1.編輯配置檔案,修改引數 以redhat6.5為例 root hjm vim etc sysconfig network scripts ifcfg eth0 修改前的配置如下 device eth0 hwaddr 00 0c 29 03 35 b5 type ethernet uuid 745b...

ubuntu配置靜態IP位址

我本人使用的linux為深度的發行版,其核心仍然是ubuntu,並且我的使用環境是vmware中。其靜態ip配置如下 1.首先sudo vim etc network inte ces 2.然後輸入如下內容 auto lo iface lo inet loopback 前兩行是系統自帶的。auto ...

RedHat靜態Ip位址配置

redhat靜態ip位址配置 依次修改以下三個檔案 etc sysconfig network etc sysconfig network scripts ifcfg eth0 etc resolv.conf 1.etc sysconfig network networking yes networ...