CentOS6.3最小化安装连接网络设置:
由于最小化安装,所以网卡没有开机启动。我们只要编辑下网卡配置文件即可。
[root@localhost ~]# cd /etc/sysconfig/network-scripts/ @进入
[root@localhost network-scripts]# vi ifcfg-eth0 @编辑
DEVICE="eth0"
BOOTPROTO="dhcp" @表示自动获取ip
HWADDR="08:00:27:6F:B0:46"
NM_CONTROLLED="yes"
ONBOOT="yes" @将no改成yes即可
TYPE="Ethernet"
UUID="26e50b06-cc3c-4328-b048-0be7947ac4e9"
[root@localhost network-scripts]# service network restart @重启
[root@localhost network-scripts]# ping baidu.com @测试
成功!
利用SSH Secure客户端连接方法:
查看ip值:
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:6F:B0:46
inet addr:192.168.1.5 Bcast:255.255.255.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe6f:b046/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3006 errors:0 dropped:0 overruns:0 frame:0
TX packets:568 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:213550 (208.5 KiB) TX bytes:73292 (71.5 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
可以知道其ip为:192.168.1.5
利用此ip即可远程连接!
注:若连接不成功,有可能22端口没有开启!
开启22端口方法:
[root@localhost ~]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
这里已经开启了22端口,若没有开启可以按上面的进行开启!
重启防火墙,使其配置生效:
[root@localhost ~]# /etc/init.d/iptables restart
由于最小化安装,所以网卡没有开机启动。我们只要编辑下网卡配置文件即可。
[root@localhost ~]# cd /etc/sysconfig/network-scripts/ @进入
[root@localhost network-scripts]# vi ifcfg-eth0 @编辑
DEVICE="eth0"
BOOTPROTO="dhcp" @表示自动获取ip
HWADDR="08:00:27:6F:B0:46"
NM_CONTROLLED="yes"
ONBOOT="yes" @将no改成yes即可
TYPE="Ethernet"
UUID="26e50b06-cc3c-4328-b048-0be7947ac4e9"
[root@localhost network-scripts]# service network restart @重启
[root@localhost network-scripts]# ping baidu.com @测试
成功!
利用SSH Secure客户端连接方法:
查看ip值:
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:6F:B0:46
inet addr:192.168.1.5 Bcast:255.255.255.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe6f:b046/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3006 errors:0 dropped:0 overruns:0 frame:0
TX packets:568 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:213550 (208.5 KiB) TX bytes:73292 (71.5 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
可以知道其ip为:192.168.1.5
利用此ip即可远程连接!
注:若连接不成功,有可能22端口没有开启!
开启22端口方法:
[root@localhost ~]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
这里已经开启了22端口,若没有开启可以按上面的进行开启!
重启防火墙,使其配置生效:
[root@localhost ~]# /etc/init.d/iptables restart