You are on page 1of 14

Linux 操作 系统

网络管理

周炯
上海艾基信 息技术有限 公司

Acegene IT Co. Ltd. 1


内容简 介
• 1 网络管理
• 2 VNC 使用
• 3 远程操作 telnet ssh rsh 使用

Acegene IT Co. Ltd. 2


1 网络管 理
• 1.1 网卡配置
• 1.2 IP 转发
• 1.3 网络设置

Acegene IT Co. Ltd. 3


1.1 网卡 配置
• 配置文件 (Redhat)
– /etc/sysconfig/network-scripts/* : 网卡
• /etc/sysconfig/network-scripts/ifcfg-eth0
– /etc/resolv.conf: DNS 配置
• 命令行
– ifconfig [eth0]
# ifconfig eth0 202.38.85.10 netmask 255.255.255.0 broadcast 202.38.85.255

– ifup [eth0] 启动网卡


– ifdown [eth0] 禁用网卡
• 图形界面
– netconfig

Acegene IT Co. Ltd. 4


1.2 IP 转发
• /proc/sys/net/ipv4/ip_forward 为 1
• /etc/sysconfig/network
– FORWARD_IPV4=YES

Acegene IT Co. Ltd. 5


1.3 网络 设置
• 主机名设置
– 配置文件 : /etc/sysconfig/network
– 命令行 : #hostname [host]
• /etc/hosts 配置
– IP long_name short_name alias
127.0.0.1 localhost.localdomain localhost localhost

Acegene IT Co. Ltd. 6


2 VNC 使用 和管理
• 远程图形终端 Remote X terminal
• 跨平台
– Linux
– Unix
– Windows
• 软件部分
– vncserver
– vncviewer

Acegene IT Co. Ltd. 7


2 VNC 服务 器端管理
• Install vnc server for Linux
– rpm –Uvh vnc-3.3.7-1.i386.rpm
• Start VNC server and stop vnc server.
– The user must be the current user to run X
application. Otherwise, will occure a
authentication error.
– vncserver :2 (localhost:2)
– vncserver –kill :2
• Set password
– vncpasswd
• Set DISPLAY
– DISPLAY=[host]:[display.0], export DISPLAY
Acegene IT Co. Ltd. 8
2 VNC 客户 端使用
• Run X application
– vncviewer [hostname]:[display]
– 如 vncviewer localhost:2
• Web 访问
– http://hostname:580x
– x 为 display 端口

Acegene IT Co. Ltd. 9


3 远程操 作 telnet
• telnet 服务管理
– chkconfig telnet on
– service telnet restart
– 或: /etc/init.d/xinit restart
• telnet 远程交互
– telnet [hostname]

Acegene IT Co. Ltd. 10


3 远程操 作 rsh
• 配置
– chkconfig rsh on
– chkconfig rlogin on
– chkconfig rexec on
• 启动服务
– service xinetd reload
– /etc/init.d/xinetd reload
– /etc/init.d/xinetd restart
• 操作命令
– rlogin 远程登录
• rlogin [hostname]
– rsh 远程 shell
• rsh [hostname]
– rcp 远程文件复制
• rcp [file] [hostname]:/[dir]
Acegene IT Co. Ltd. 11
3 远程操 作 ssh
• 配置文件
– /etc/ssh/ssh_config
• 操作命令
– ssh 远程 shell
• ssh [hostname]
– scp 远程文件复制
• scp [file] [hostname]:/[dir]

Acegene IT Co. Ltd. 12


Q&
A
QUESTIONS
ANSWERS
练习
• 配置网卡的地址
– 通过配置文件修改虚拟机上的 bridge 网卡
• 保证这个地址从局域网可以访问
• 配置网络
– 修改主机名 hostname
– 设置 /etc/hosts
• 实现远程主机基于主机名访问
• 使用 VNC
– 启动 vnc 服务器在 :3
– 通过浏览器访问 vnc
– 执行 xclock 程序,显示时钟
# export DISPLAY=:3.0
# xclock
• 使用 ssh scp
– 两个 Linux 系统之间相互登录 ssh
– 在两个 Linux 系统之间拷贝文件 scp
Acegene IT Co. Ltd. 14

You might also like