‘壹’ CentOs 7怎么联网
首先,鼠标右击桌面,点击“在终端中打开”。
然后如下图所示,输入:su,按回车后输入自己的root密码;注意,输密码的时候密码区域并不显示任何东西哦,自己输错了就多按几次backspace就行了,成功后在输命令前的符号就变成了#。
如下图所示,输入,注意画红线的部分,你的可能和我的不太一样,记住或复制下来都行,下面要多次用到,把下面步骤中的“eno16777736”都换成自己的就行了。
然后输入,c,这里的"eno16777736"换成自己的就行了,下面步骤也是如此。
5
注意下面的红圈部分,如果你的是显示的“ONBOOT=no”,就不能上网。下面先把它改为“yes”。
‘贰’ centos怎么在命令行联网
这里有两种方法,看你喜欢哪一种了。
CentOS 其实有个setup的命令,是图形的,可以很方便的修改一些参数。但为了显示我们强大的linux功能,所以我
可以在字符界面下修改配置,是不是要拉风一点?
修改对应网卡的IP地址的配置文件
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
修改以下内容
DEVICE=eth0 #描述网卡对应的设备别名,例如ifcfg-eth0的文件中它为eth0
BOOTPROTO=static #设置网卡获得ip地址的方式,可能的选项为static,dhcp或bootp,分别对应静态指定的 ip地址,通过dhcp协议获得的ip地址,通过bootp协议获得的ip地址
BROADCAST=192.168.0.255 #对应的子网广播地址
HWADDR=00:07:E9:05:E8:B4 #对应的网卡物理地址
IPADDR=192.168.1.2 #如果设置网卡获得 ip地址的方式为静态指定,此字段就指定了网卡对应的ip地址
NETMASK=255.255.255.0 #网卡对应的网络掩码
NETWORK=192.168.1.0 #网卡对应的网络地址
ONBOOT=yes #系统启动时是否设置此网络接口,设置为yes时,系统启动时激活此设备
内网修改IP实例:
DEVICE=eth0
BOOTPROTO=none
IPADDR=192.168.1.155
GATEWAY=192.168.1.1
ONBOOT=yes
TYPE=Ethernet
保存并执行重启网络服务
#/sbin/service network restart
二、CentOS 修改网关
修改对应网卡的网关的配置文件
[root@centos]# vi /etc/sysconfig/network
修改以下内容
NETWORKING=yes(表示系统是否使用网络,一般设置为yes。如果设为no,则不能使用网络,而且很多系统服务程序将无法启动)
HOSTNAME=centos(设置本机的主机名,这里设置的主机名要和/etc/hosts中设置的主机名对应)
重新启动网络配置
# service network restart
或
# /etc/init.d/network restart
‘叁’ centos6.4如何设置无线网
CentOS-6.4无线上网命令行配置介绍:
待连接的WIFI的ssid为“thm”,密码为12345678,认证方式为WPA2-PSK
1. 检查无线网卡驱动是否安装
1 xxx#iwconfig若打印wlan0(或其他名字)的无线网卡信息,则表明无线网卡驱动已经安装,否则要先安装无线网卡驱动方能继续。
2. 配置/etc/sysconfig/network-scripts/ifcfg-wlan0
我的配置文件内容为:
1 DEVICE=wlan0
2 HWADDR=9C:4E:36:9A:64:10
3 TYPE=Wireless
4 UUID=f017bd9c-eebf-46fc-823c-7f76cc8d5abf
5 ONBOOT=no
6 NM_CONTROLLED=yes
7 BOOTPROTO=dhcp
8 ESSID="thm"3. 安装工具wpa_supplicant
1 xxx#yum install wpa_supplicant4. 配置/etc/wpa_supplicant/wpa_supplicant.conf,写入相关ssid和对应的密码
1 xxx#wpa_passphrase thm 12345678 >> /etc/wpa_supplicant/wpa_supplicant.conf我的配置文件内容为:
1 ctrl_interface=/var/run/wpa_supplicant
2 ctrl_interface_group=wheel
3
4 network={
5 ssid="thm"
6 #psk="12345678"
7 psk=. 后台运行wpa_supplicant进程
1 xxx#wpa_supplicant -B -Dwext -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf6. 搜索无线网络
1 xxx#iwlist wlan0 scan | grep ESSID7. 连接无线网络
1 xxx#iwconfig wlan0 essid "thm"8. dhcp方式获取ip
1 xxx#dhclient wlan09. 测试网络是否联通
1 xxx#ping www..com
‘肆’ 如何用命令查看centos系统是否联网
CentOS 7系统与以前centos6是有一些区别的,那么如何在CentOS 7 中查看网络连接?有需要了解的朋友可以和小编一起来看看吧。 一直用 ifconfig 命令查看 CentOS 中的网络连接,包括 IP 地址、MAC 地址、网络连接状态等。升级到 CentOS 7 之后 ifconfig 就找不到了,原来这个指令已经被废弃,改用 ip 指令。同样的事情也发生在 RHEL 7、Oracle Linux 7、Scientific Linux 7 的 minimal 版本中。 在 CentOS 7 minimal 系统中,可以用 “ip addr”、“ip link”查看网络连接及其状态,使用“ip –s link”还可以查看统计信息。 如果还是想使用 ifconfig 的话就需要自己安装了。先得知道 ifconfig 指令是哪个软件包提供的, yum provides ifconfig 或者, yum whatprovides ifconfig 可以查询到对应的软件包为 net-tools,安装它, yum install net-tools 安装好了就可以用 ifconfig –a 查看网络状态了。 当然这样的方法也适用于查询其它想用但是又找不到对应指令的安装软件包的情况。 将 Linode VPS 也部署成 CentOS 7 了,才发现 Linode 上的 CentOS 7 已经定制过,包含了常用的但是在 7 版中已经废弃的指令,如 ifconfig、netstat、iptables 等。
‘伍’ 如何设置设置centos 7拨号上网
CentOS 7拨号上网(ADSL & PPPoE)
步骤概述:
1、搜寻PPPoE相关软件,本人使用的是rp-pppoe
yum search pppoe
2、使用yum安装rp-pppoe
yum install rp-pppoe -y
3、开始配置PPPoE连接
pppoe-setup
4、输入ISP提供的账户
5、输入以太网卡代号,默认是eth0(注:CentOS 7已不是默认eth0,自行使用ifconfig命令即可找到)
6、配置:若长时间连线,连线会被自动中断(我不干,选no)
7、配置主DNS服务器
8、配置次DNS服务器
9、两次输入账户密码以确认
10、配置普通账户是否有网络连接权限
11、配置防火墙(没有特殊需求选0就OK)
12、配置是否开机自动拨号连接
13、确认刚填写的配置信息
14、连接网络尽情享受吧!
相关命令@ 连接网络:/sbin/ifup ppp0,断开连接:/sbin/ifdown ppp0,查看网络状态:/sbin/pppoe-status
................. 这是华丽丽的分割线 ......................
获取以太网卡代号
[plain] view plain
[dsp@dsp Desktop]$ ifconfig
enp9s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 # 有线网卡
ether 20:1b:06:3d:22:05 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 2297 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 18
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 2 bytes 110 (110.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2 bytes 110 (110.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:36:45:23 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp8s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 # 无线网卡
inet 192.168.0.151 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::4ad2:24ff:fee8:f962 prefixlen 64 scopeid 0x20<link>
ether 48:d2:24:e8:f9:62 txqueuelen 1000 (Ethernet)
RX packets 20017 bytes 16100210 (15.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 18263 bytes 2641746 (2.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
配置rp-pppoe客户端
[plain] view plain
[root@dsp Desktop]# pppoe-setup
Welcome to the PPPoE client setup. First, I will run some checks on
your system to make sure the PPPoE client is installed properly...
LOGIN NAME
Enter your Login Name (default dsp): 12345 # 网络服务提供商提供的账户
INTERFACE
Enter the Ethernet interface connected to the PPPoE modem
For Solaris, this is likely to be something like /dev/hme0.
For Linux, it will be ethX, where 'X' is a number.
(default eth0): enp9s0 # 选择以太网卡,有线网卡
Do you want the link to come up on demand, or stay up continuously?
If you want it to come up on demand, enter the idle time in seconds
after which the link should be dropped. If you want the link to
stay up permanently, enter 'no' (two letters, lower-case.)
NOTE: Demand-activated links do not interact well with dynamic IP
addresses. You may have some problems with demand-activated links.
Enter the demand value (default no): no # 输入no,否则若长时间连线,连线会被自动中断
DNS
Please enter the IP address of your ISP's primary DNS server.
If your ISP claims that 'the server will provide dynamic DNS addresses',
enter 'server' (all lower-case) here.
If you just press enter, I will assume you know what you are
doing and not modify your DNS setup.
Enter the DNS information here: 8.8.8.8 # 主DNS服务器IP,本人使用Google Public DNS
Please enter the IP address of your ISP's secondary DNS server.
If you just press enter, I will assume there is only one DNS server.
Enter the secondary DNS server address here: 8.8.4.4 # 二级DNS服务器IP
PASSWORD# 账户对应的密码,需两次输入以确认无误
Please enter your Password:
Please re-enter your Password:
USERCTRL
Please enter 'yes' (three letters, lower-case.) if you want to allow
normal user to start or stop DSL connection (default yes): yes # 普通用户是否可以启动停止网络连接
FIREWALLING
Please choose the firewall rules to use. Note that these rules are
very basic. You are strongly encouraged to use a more sophisticated
firewall setup; however, these will provide basic security. If you
are running any servers on your machine, you must choose 'NONE' and
set up firewalling yourself. Otherwise, the firewall rules will deny
access to all standard servers like Web, e-mail, ftp, etc. If you
are using SSH, the rules will block outgoing SSH connections which
allocate a privileged source port.
The firewall choices are:
0 - NONE: This script will not set any firewall rules. You are responsible
for ensuring the security of your machine. You are STRONGLY
recommended to use some kind of firewall rules.
1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation
2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway
for a LAN
Choose a type of firewall (0-2): 0# 选 0 吧
Start this connection at boot time
Do you want to start this connection at boot time?
Please enter no or yes (default no):yes# 是否系统启动是就连接网络
** Summary of what you entered **
Ethernet Interface: enp9s0
User name: 12345
Activate-on-demand: No
Primary DNS: 8.8.8.8
Secondary DNS: 8.8.4.4
Firewalling: NONE
User Control: yes
Accept these settings and adjust configuration files (y/n)? y# 确认刚才输入的网络配置信息
Adjusting /etc/sysconfig/network-scripts/ifcfg-ppp0
Adjusting /etc/resolv.conf
(But first backing it up to /etc/resolv.conf.bak)
Adjusting /etc/ppp/chap-secrets and /etc/ppp/pap-secrets
(But first backing it up to /etc/ppp/chap-secrets.bak)
(But first backing it up to /etc/ppp/pap-secrets.bak)
Congratulations, it should be all set up!
Type '/sbin/ifup ppp0' to bring up your xDSL link and '/sbin/ifdown ppp0'# rp-pppoe的操作命令
to bring it down.
Type '/sbin/pppoe-status /etc/sysconfig/network-scripts/ifcfg-ppp0'
to see the link status.
[root@dsp Desktop]# /sbin/ifup ppp0# 启动网络连接
[root@dsp Desktop]# /sbin/pppoe-status# 查看网络连接状态
pppoe-status: Link is up and running on interface ppp0
6: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc pfifo_fast state UNKNOWN qlen 3
link/ppp
inet 10.198.0.17 peer 10.198.1.1/32 scope global ppp0
valid_lft forever preferred_lft forever
‘陆’ centos 7如何联网
首先你要确定的是你的Centos有没有正确识别你的网卡,lsmod看看网卡驱动模块有没有正确加载或ifconfig eth0看没有该设备,如果有,vi编辑该配置文件(/etc/sysconfig/network-scripts/ifcfg-eth0),把BOOTPROTO改为dhcp,ONBOOT=yes,保存退出,重启网络服务(service network restart)即可。也可用setup向导方式来设置,但这种方式仍需要修改ONBOOT选项;另一种情况就是没有驱动,相信你知道怎么处理了吧?安装驱动,后面的步骤差不多。
‘柒’ virtualbox虚拟机上的centos怎么上网设置
方法/步骤
首先,在VirtualBox中设置网卡连接方式:点“设置”,在弹出的界面中点“网络”,最后选择“连接方式”为“桥接网卡”,看下图:
回到centOS中,进入终端(可以点击鼠标右键,选择Konsole,进入终端,当然,还有其他的方法,这里我就不多说了)。输入命令:ifconfig -a,查看网络配置文件的名字,我的是enp0s3,看下图红框,当然我是已经开启的,没有开启的是不显示紫框的内容的。
用Vim编辑器打开配置文件,输入命令:vi /etc/sysconfig/network-scripts/ifcfg-enp0s3,就会看到下图红框部分。按"A"键进入Vim编辑器的编辑模式,把ONBOOT=no改为ONBOOT=yes,然后按"Esc"键退出编辑模式,最后输入“:wq”按回车键保存并退出。
最后我们重启网络服务,输入命令:service network restart
这些工作做完后,就OK了。我们ping下我们亲爱的度娘就可以ping通了,不过不要忘了按Ctrl+C哦。
‘捌’ centos7怎么通过代理上网
1. 界面设置
squid默认代理端口3128。
2. firefox设置
设置 -> 局域网设置 -> ip:port / username:passwd
二、terminal分别设置代理
1. 临时代理proxy
如果只是暂时使用代理,在命令行输入下面一条命令:
export http_proxy="http://210.45.72.XX:808"1
另外:
/root/.bashrc中加入:
export http_proxy="http://username:[email protected]:808"
如果是通过ip或电脑的网卡地址认证,可忽略所有username 和 password .
注:停止使用代理的时候,要把改过的文件改成原样.尤其是如果使用了export
注:停止使用代理的时候,要把改过的文件改成原样.
尤其是如果使用了export http_proxy="http://210.45.72.XX:808"命令,
要在命令行输入:unset http_proxy ,去除环境变量.
因为export http_proxy=”http://210.45.72.XX:808”这条命令的实质是把export后面的设置写进环境设置文件中.
输入env 可以看所有的环境变量设置.
env >env.txt 可以把环境变量输出到env.txt中,然后打开看也可以.
unset 变量 可以取消曾经设过的环境变量.
2. 全局代理proxy
文件目录
vim /etc/profile1
添加如下
http_proxy=http://username:password@yourproxy:8080/
ftp_proxy=http://username:password@yourproxy:8080/
export http_proxy
export ftp_proxy1234
环境变量
source /etc/profile1
3. yum proxy
文件目录
vim /etc/yum.conf1
添加如下
proxy=http://username:password@yourproxy:8080/1
环境变量
source /etc/profile1
4. wget proxy
文件目录
vim /etc/wgetrc1
最后行添加如下
http_proxy=http://username:password@yourproxy:8080
https_proxy=http://username:password@yourproxy:8080
ftp_proxy=http://username:password@yourproxy:8080123
环境变量
source /etc/profile1
更新163源
在自己安装的CentOS6.5中使用yum安装软件,总是提示404错误信息,网络后发现原来要设置yum源。
在安装完CentOS后一般需要修改yum源,才能够在安装更新rpm包时获得比较理想的速度。国内比较快的有163源、sohu源。这里以163源为例子。
1. cd /etc/yum.repos.d
2. mv CentOS-Base.repo CentOS-Base.repo.backup
3. wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
4. mv CentOS6-Base-163.repo CentOS-Base.repo
5. yum clean all12345678
更新速度加快
‘玖’ centos 7 怎样配置网络
一. 查看网络地址:
centos7取消了ifconfig命令,使用ip addr命令查看IP地址
二.配置网络
用VirtualBox安装的CentOS7,安装完成后,发现无法上网,于是到网上查了一下,经过以下几步即可上网。
1.找到以太网卡配置文件ifcfg-enp**文件,过面的数字好像是随机生成的。
2. 使用Root打开并编辑些文件,将onboot的"no"改为“yes”,然后重启网络。
最后输入:wq 保存并退出,再重启一下network:
3.重启网络命令
# service network restart
这样再启动系统时,网络也会自动启动。