萌新的linux之旅12

2021-08-04 14:10:21 字數 2377 閱讀 7161

#

11.管理網路

#1.ip基礎知識

1.ipv4

2進製32位—–10進製

172.25.0.10/255.255.255.0

172.25.0.10:ip位址

255.255.255.0:子網掩碼

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

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

2.配置ip

《圖形化》

1.圖形介面

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 device disconnect eth0

nmcli device show

nmcli device status

dhcp動態設定

dhcp ##動態獲取

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

device=eth0 ##介面使用裝置

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

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

name=eth0 ##網路介面名稱

:wq

systemctl restart network

3.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

5.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伺服器,那個在前面那個優先

閘道器設定就是利用閘道器的ip,讓多個子網ip可以偽裝成閘道器ip,然後利用dns解析上網

萌新linux之旅4

管理輸入輸出 在目錄層次結構中搜尋檔案 find 在系統中用普通使用者執行 student find etc name passwd student使用者許可權被拒絕時會有以下輸出 find etc pki ca private permission denied 許可權被拒絕 find etc p...

萌新的linux之旅19

系統正常引導過程 如果引導程式boot損壞 446位元組是啟動引導 dd if dev zero of dev vda bs 446 count 1 注意一定是446 多了或少了都不能正常引導修復 保證selinux是disabled 然後重啟,發現一直在booting,即無法引導系統系統 關閉虛擬...

萌新的51之旅

本人是微控制器學習的萌新一枚,學習微控制器等知識目的就是提公升自己專業方面的綜合的素質修養,我將會把自己的每次的學習的內容和心理歷程記錄下來,分享給大家的同時也加深自己的理解。眾所周知,微控制器的入門51是再好不過的選擇,對於我這種剛剛接觸微控制器的人來說,我覺得51微控制器還是十分容易接受的,首先...