配置ip



打开配置文件

sudo vim /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface
auto lo
iface lo inet loopback # The primary network interface
#auto enp0s3
#iface enp0s3 inet dhcp auto enp0s3
iface enp0s3 inet static
address 192.168.1.122
netmask 255.255.255.0
gateway 192.168.1.1

重启网络

sudo /etc/init.d/networking restart

关闭防火墙(详情:https://www.cnblogs.com/kluan/p/5993767.html)

sudo ufw disable 

查看防火墙的状态:(状态显示是“inactive”关闭状态。)如果ping不通大多是防火墙的问题

sudo ufw status

修改dns /etc/resolvconf/resolv.conf.d/base里面是空的添加

nameserver 你的DNS1

nameserver 你的DNS2

修改DNS楼主亲测 vim /etc/resolv.conf(阿里的DNS)

nameserver 223.5.5.5
nameserver 223.6.6.6

重启网络

sudo /etc/init.d/networking restart
//14.01版本
sudo ifconfig eth0 down
sudo ifconfig eth0 up

默认重启命令行模式

vim  /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT=""改GRUB_CMDLINE_LINUX_DEFAULT="test"
sudo update-grub

查看网卡名

ls /proc/sys/net/ipv4/conf

刷新ip

ip addr flush dev

修改网卡名称

http://blog.csdn.net/wenwenxiong/article/details/52937539

http://blog.csdn.net/wy_97/article/details/78294562

温馨提示:

1.虚拟主机和主机之间ip不通,怎么办?

答:绝大多数都是防火墙的问题

2.如果虚拟主机和主机之间可以ping通, 但是不能上网怎么办?

答:肯定是DNS配置问题.

Ubuntu/Linux网络配置常用命令的更多相关文章

  1. Linux网络配置常用命令

    计算机需要网络连接才能和其他计算机通信,这是通过操作系统识别接口卡(如以太网卡.猫等等),并配置该接口以连接到网络上来实现的.网络配置命令可以用来配置以下类型的网络接口:以太网.ISDN(综合业务数字 ...

  2. linux网络配置相关命令、虚拟网络接口eth0:0

    网络接口(interface)是网络硬件设备在操作系统中的表示方法,比如网卡在Linux操作系统中用ethX,是由0开始的正整数,比如eth0.eth1...... ethX.而普通猫和ADSL的接口 ...

  3. Linux——网络配置及命令

    traceroute命令(unix)/tracert命令(windows) tracert命令的格式为:tracert [-d] [-h maximum_hops] [-j host-list] [- ...

  4. Linux网络配置 RPM命令 samba服务 Linux目录结构

    第一种方法: (1)用root身份登录,运行setup命令进入到 text mode setup utiliy对网络进行配置,这里可以进行ip,子网掩码,默认网关,dns的设置.(2)这时网卡的配置没 ...

  5. linux网络配置相关文件

    网络接口(interface)是网络硬件设备在操作系统中的表示方法,比如网卡在Linux操作系统中用ethX,是由0开始的正整数,比如eth0.eth1...... ethX.而普通猫和ADSL的接口 ...

  6. Linux网络——配置网络之ifconfig家族命令

    Linux网络——配置网络之ifconfig家族命令 摘要:本文主要学习了ifconfig家族用来配置网络的命令. ifconfig命令 ifconfig命令用来显示或设置网络接口信息,设置只是临时生 ...

  7. Linux中的网络管理——网络配置及命令

    Linux网络配置 在Linux中配置IP地址的方法有以下这么几种: 图形界面配置IP地址(操作方式如Windows系统配置IP,但在实际生产中,我们并不建议在我们的服务器上安装Linux的图形界面, ...

  8. linux网络配置命令(一)——ifconfig

    linux网络配置命令(一)——ifconfig ifconfig 查看.配置网卡信息.已过时,推荐使用ip命令 格式:  ifconfig [interface]                   ...

  9. Linux网络配置和网络诊断命令介绍

    方法/步骤 1 在接下来的讲解中,讲解的Linux网络配置和网络诊断的命令有: ifconfig.ping.netstat.traceroute.dig和nslookup.host.hostname. ...

随机推荐

  1. 图标网站,IcoMoon,自己动手做一个 font

    很有用的IcoMoon,在线制作工工具:https://icomoon.io/app/#/select/font 大神解说:如何灵活利用免费开源图标字体-IcoMoon篇http://www.zhan ...

  2. Solr之.net操作

    http://www.cnblogs.com/zhangweizhong/category/771055.html 插入: SolrNet.Startup.Init<Movie>(&quo ...

  3. Hibernate or 的用法

    转自baidu estrictions.or(Restrictions.like(),Restrictions.or(Restrictions.like,........))里面的or可以无限加的.还 ...

  4. android 加载图片

    package mydemo.mycom.demo2; import android.graphics.Bitmap; import android.graphics.BitmapFactory; i ...

  5. Maven整合Spring3.0+Mybatis3.2+Struts2.3+查找坐标+jar包依赖(五)

    依赖传递 只添加了一个struts2-core依赖,发现项目中出现了很多jar,这种情况 叫 依赖传递

  6. Hard Negative Mning

    对于hard negative mining的解释,引用一波知乎: 链接:https://www.zhihu.com/question/46292829/answer/235112564来源:知乎 先 ...

  7. UML和模式应用4:初始阶段(5)--用例编写的准则

    1.前言 本文主要介绍用例编写时所遵循的几条基本准则. 2.用例编写的准则 2.1 以本质的风格编写用例 如系统认证,而不要说 需要输入ID进行认证等 2.2 编写简洁的用例 如系统认证,不要说 这个 ...

  8. MySQL在线更改binlog格式

    今天变更jboss报错如下: SQLWarning ignored: SQL state ', message [Unsafe statement written to the binary log ...

  9. windows命令行中英文切换

    Windows下cmd命令提示符窗口的语言设置(中英) 打开cmd命令提示窗口 输入 chcp 936 使用ping 命令 显示中文 2 同样 输入chcp 437 3 使用ping 命令

  10. ubuntu数据库迁移

    环境:ubuntu16.04 简介:本教程演示如何从旧数据库服务器服转移到另一个新服务器. 场景:假设你有自己的云服务器安装了WordPress站点,你为了更多的内存和处理能力想升级到新的服务器. 操 ...