『壹』 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
這樣再啟動系統時,網路也會自動啟動。