設定指定ip和自動獲取ip

2021-09-01 02:13:39 字數 632 閱讀 9284

1. 設定指定固定ip的bat檔案

@echo off

@echo 開始設定

netsh inte***ce ip set address name="本地連線" source=static addr=192.168.1.2 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=auto

netsh inte***ce ip set dns name="本地連線" source=static addr=202.106.0.20 register=primary

netsh inte***ce ip add dns name="本地連線" addr=123.123.123.123 index=2

@echo on

@echo ip已設定

@echo off

pause

exit

2. 設定自動獲取ip的bat檔案

@echo off

netsh inte***ce ip set address "本地連線" dhcp

netsh inte***ce ip set dns "本地連線" dhcp

注意: 經試用,儲存檔案時,把檔案的編碼型別設定為ansi/ascii. 不知道問為什麼呢。

使用 bat 自動設定IP位址和自動獲取IP位址

自動設定ip位址.bat echo off echo 手動設定ip位址.netsh inte ce ip set addr 本地連線 static 192.168.1.8 255.255.255.0 192.168.1.1 1 echo 手動設定dns位址.netsh inte ce ip set ...

Linux開機自動獲取IP

vmware安裝centos完畢,登入系統之後輸入 ifconfig命令,如下圖所示 未獲取有效ip 檢查vmware的網路配置資訊,如下圖所示 臨時方案 用ifup命令啟用指定網路介面 ifup eth0 說明 此方案只適用於一次性使用,系統重啟後,需要再次啟用。使用root使用者登入系統,執行以...

配置DHCP,自動獲取IP

硬體環境 am1808 核心 linux 2.6.33 busybox版本 busybox 1.7.0 1.配置核心 networking support networking support networking options packet socket ip kernel level auto...