knowledge/docs/linux/ubuntu配静态IP.md

31 lines
498 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 为ubuntu系统配置静态ip地址
---
> 如果使用非root用户需要在命令前加sudo
## ubuntu 16.04
```bash
vim /etc/network/interfaces
```
只修改eth0部分或者是别的网卡名
```conf
auto eth0
iface eth0 inet static
address 183.211.245.49
netmask 255.255.255.128
broadcast 183.211.245.127
gateway 183.211.245.1
dns-nameservers 221.131.143.69
```
如果想用dhcp自动获取ip的话照下面改
```conf
auto eth0
iface eth0 inet dhcp
```