Last active
April 11, 2016 05:44
-
-
Save zyjibmcn/38cc8791b3db29c549193cae728c0ff7 to your computer and use it in GitHub Desktop.
linux 下如何修改IP 并即时生效
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ---修改ip地址--- | |
ifconfig eth0 192.168.1.155 netmask 255.255.255.0 | |
# ---修改default gateway--- | |
route add default gw 192.168.1.1 | |
# 注意:一定要修改默认网关,否则外部ping 不通。 可以在修改IP前,通过netstat -rn 查看默认网关设置。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment