網路的基本設定

2021-08-04 11:30:14 字數 3010 閱讀 8295

*******************************11.管理網路******************************************1.ip

一.網路位址基礎知識

1.ipv4

2進製32位寫成10進製是四位

172.25.0.10/255.255.255.0

255.255.255.0:子網掩碼

子網掩碼255位對應的ip位為網路位

子網掩碼0位置對應的ip位為主機位

二.配置ip

1.圖形介面

nm-connection-editor

2.文字化圖形

nmtui

—命令-

ifconfig 網絡卡 ip netmask    ****臨時設定

nmcli connection add type ethernet con-name westos ifname eth0 autoconnect yes

nmcli connection add type ethernet con-name westos ifname eth0 ip4 ip/24

nmcli connection delete westos 刪除以配置好的位址

nmcli connection show

nmcli connection down westos

nmcli connection up westos

nmcli connection modify "westos" ipv4.addresses newip/24

nmcli connection modify "westos" ipv4.method

nmcli device connect eth0

nmcli device disconnect eth0

nmcli device show

nmcli device status

——檔案--

dhcp         **動態獲取

vim /etc/sysconfig/network-scripts/ifcfg-eth0

device=eth0        ##介面使用裝置

bootproto=dhcp        ##網絡卡工作模式

onboot=yes        ##網路服務開啟時自動啟用

name=eth0        ##網路介面名稱

static|none    **靜態網路

vim /etc/sysconfig/network-scripts/ifcfg-eth0

device=eth0             *****裝置

bootproto=static|none         ****裝置工作方式

onboot=yes             ***開啟網路服務啟用裝置

name=eth0             ****網路介面名稱

ipaddr=172.25.0.100          ****ip

netmask=255.255.255.0 | prefix=24 ****子網掩碼

三.gateway(閘道器)

1.路由器

主要功能是用來作nat的

dnat    目的地位址轉換

snat    源位址轉換

2.閘道器

路由器上和自己處在同乙個網段的那個ip

3.設定閘道器

systemctl stop     netwrokmanager

vim /etc/sysconfig/network    ***全域性閘道器

gateway=閘道器ip

vim /etc/sysconfig/network-scripts/ifcfg-網絡卡配置檔案 ****網絡卡介面閘道器

gateway=閘道器ip

網絡卡藉口裡沒有閘道器的看全域性閘道器,有的話就用網絡卡藉口閘道器

systemctl restart netwrok

route -n            **查詢閘道器

kernel ip routing table

destination     gateway         genmask         flags metric ref    use iface

0.0.0.0   (閘道器)172.25.0.254    0.0.0.0         ug    0      0        0 eth0

172.25.0.0      0.0.0.0         255.255.255.0   u     0      0        0 eth0

四.dns

1.dns

dns是一台伺服器

這太伺服器提供了回答客戶主機名和ip對應關係的功能

2.設定dns

vim /etc/resolv.conf

nameserver dns伺服器ip

vim /etc/sysconfig/network-scripts/ifcfg-網絡卡配置檔案

dns1=dns伺服器ip

3.本地解析檔案

vim /etc/hosts

ip    主機名稱

4.本地解析檔案和dns讀取的優先順序調整

/etc/nsswitch.conf

38 #hosts:     db files nisplus nis dns

39 hosts:      files dns       files代表本地解析檔案,dns代表dns伺服器,那個在前面那個優先

5.dhcp服務的配置

Linux中基本網路設定(一)

知識結構 一 檢視網路設定 1,檢視網路介面資訊ifconfig 檢視所有活動網路介面的資訊 檢視指定網路介面資訊 ifconfig 網路介面號2,檢視主機名稱hostname hostname命令 檢視或設定當前主機名 臨時修改 hostname 或者 systemctl set hostname...

Linux網路的安全設定(基本命令)

二.測試網路設定 三.設定網路引數的方式 ifconfig命令 檢視所有活動的網路介面資訊 ifconfig 網路介面 檢視指定的網路介面資訊 例如 ifconfig ens33 hostname命令 檢視或設定當前主機名 語法 hostname 主機名 route命令 檢視或設定主機中路由表資訊 ...

IDEA的基本設定

intellij idea 快捷鍵和設定 intellij idea 使用總結 intellij idea 問題解決 1.亂碼,主要是快捷鍵的字樣顯示亂碼 中文字型顯示亂碼?2.選單項等的字型太小,怎麼能設定下?實用快捷鍵 ctrl 或 ctrl shift 注釋 或者 ctrl d 複製行 ctr...