Skip to content

Instantly share code, notes, and snippets.

@zyjibmcn
Last active April 11, 2016 05:44
Show Gist options
  • Save zyjibmcn/38cc8791b3db29c549193cae728c0ff7 to your computer and use it in GitHub Desktop.
Save zyjibmcn/38cc8791b3db29c549193cae728c0ff7 to your computer and use it in GitHub Desktop.
linux 下如何修改IP 并即时生效
#!/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