1,自動獲取ip的方法
自動獲取與4個檔案有關係
a),/etc/sysconfig/network-scripts/ifcfg-eth0
[zhangy@localhost network-scripts]$ cat ifcfg-eth0
# marvell technology group ltd. 88e8039 pci-e fast ethernet controller
device=eth0//由eth0來啟動
bootproto=dhcp//獲取ip的方式是自動獲取,static是固定ip,none是手動
hwaddr=00:16:d3:a2:f6:09//網絡卡的實體地址
ipv6init=yes//是否支援ip6
ipv6_autoconf=yes//ip6是否自動配置
onboot=yes//啟動時網路介面是否有效,我只改了這行重啟後就可以了
b),/etc/sysconfig/network
[zhangy@localhost network-scripts]$ cat /etc/sysconfig/network
networking=yes//網路是否可用
networking_ipv6=yes
hostname=localhost.localdomain//主機名,主機名在/etc/hosts裡面配置
c),/etc/hosts
[zhangy@localhost network-scripts]$ cat /etc/hosts
# do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1localhost.localdomainlocalhost//根/etc/resolv.conf中search要對應,localhost.localdomain
::1 localhost6.localdomain6 localhost6
d),/etc/resolv.conf
[zhangy@localhost network-scripts]$ cat /etc/resolv.conf
; generated by /sbin/dhclient-script
nameserver 192.168.1.1//dns伺服器對應的ip
searchlocaldomain//搜尋要找的網域名稱,在/etc/hosts裡面設定的有
2,手動設定
手動設定只要修改三個檔案就可以了
a),/etc/sysconfig/network
[zhangy@localhost network-scripts]$ cat /etc/sysconfig/network
networking=yes
networking_ipv6=yes
#hostname=localhost.localdomain//為什麼要把主機名注釋掉,一般先解析主機名或者網域名稱,再解析dns
gateway=192.168.1.1//加上閘道器
b),/etc/sysconfig/network-scripts/ifcfg-eth0
[zhangy@localhost network-scripts]$ cat ifcfg-eth0
# marvell technology group ltd. 88e8039 pci-e fast ethernet controller
device=eth0
bootproto=none//啟動為手動
broadcast=192.168.1.255
hwaddr=00:16:d3:a2:f6:09
ipaddr=192.168.1.108//設定的ip
netmask=255.255.255.0//子網掩碼
network=192.168.1.0
ipv6init=yes
ipv6_autoconf=yes
onboot=yes
type=ethernet//網路型別
c),/etc/resolv.conf
[zhangy@localhost network-scripts]$ cat /etc/resolv.conf
#; generated by /sbin/dhclient-script
#nameserver 192.168.1.1
#search localdomain
nameserver 116.228.111.118//加上主dns
nameserver 180.168.255.18//加上次dns
Linux中通過修改MTU值來修改網速
通過adsl寬頻 貓 上網,系統為redhat 9.0,但在上網時有些網頁打不開,而且網速不快。這跟mtu值有關係,將它修改到適當的值即可。在windows下可以通過修改登錄檔來修改mtu值,可在linux下面又該如何做呢?其實只需要乙個簡單的命令即可 ifconfig eth0 mtu numbe...
Linux 中修改網路配置
修改主機名 1 臨時修改主機名 xieqc.cn hostname xieqc.cn 只針對本次登陸有效 2 永久生效 hostnamectl set hostname xieqc.cn 3 影象化更改主機名 nmtui 4 修改配置檔案 vim etc hostname 重啟後生效 永久生效 修改...
linux下用python來批量修改檔名
我們在維護系統的時候,有時候遇到需要批量修改乙個資料夾下的所有檔名,這個時候,如果用人工手動的去修改的話,那就太沒有效率了,這個時候我們需要乙個指令碼來完成我們的任務,當然用shell,perl也可以完成,今天這裡介紹的是用python來解決這個問題,我們假設在 root test 下面有4個檔案,...