惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
有赞技术团队
有赞技术团队
L
LangChain Blog
C
Check Point Blog
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
美团技术团队
博客园 - 司徒正美
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
S
SegmentFault 最新的问题
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale
Hugging Face - Blog
Hugging Face - Blog
博客园 - 叶小钗
腾讯CDC
B
Blog
G
Google Developers Blog
The Cloudflare Blog
P
Proofpoint News Feed

博客园 - ddr888

Ubuntu16.04LTS国内快速源 bitnami redmine版本由2.3.1升级至3.2.2过程 Ubuntu1404安装gogs过程 Excel根据单元格背景色批量设置格式的宏 服务器监控之热身:只是试用monit SAP ABAP鸟瞰【AV+PPT】 常用SAP表 HP-UX 11i v2上Oracle10.2基本安装指南 Debian5 dom0上跑Xen Debian5 lenny domU&Xen ubuntu10.04 Lucid domU--我爱你,飞一般的感觉 SAP BW BEx工具集简单介绍【AV+PPT】 resolve.conf引起登录HPUX的CDE故障 cx_Oracle说:Python访问Oracle并不难 让服务器时间“云”起来【拍死标题党】 ubuntu 10.04 源 HP-UX下使用python发送邮件 HP-UX 11i v2安装使用python 2.5.2 birdnest 102 api出现internel error处理 mac上配置rails开发环境 Heroku使用手记
ubuntu常用网络服务配置
ddr888 · 2009-09-29 · via 博客园 - ddr888

引言

        本文介绍ubuntu系统的基本网络配置,包括IP配置、ftp服务配置等,实施环境为ubuntu 9.04 Server版。红色标记为重要的命令或过程。

一、ubuntu IP配置

配置ip:

sudo ifconfig eth1 172.20.10.* netmask 255.255.255.0

sudo route add default gw 172.20.10.1

配置dns:

sudo vi /etc/resolv.conf

在其中添加一条:

nameserver 172.20.1.*

配置完成,ping一下网关和g.cn:

ping 172.20.10.1

ping g.cn

如果有反应说明配置成功,eth1 是你的网卡,这里不一定是eth1,一般默认第一块网卡是eth0,可以通过下面的命令查看网络接口名:

netstat -i

Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth1       1500 0  18936348     16     16 0          2160      0      0      0 BMRU
lo        16436 0       734      0      0 0           734      0      0      0 LRU

网络配置文件:

sudo vi /etc/network/interfaces

这里的内容为:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth1
iface eth1 inet static
        address 172.20.10.*
        netmask 255.255.255.0
        network 172.20.10.0
        broadcast 172.20.10.255
        gateway 172.20.10.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 172.20.10.*

可以在这个配置文件中手动编辑ip地址和dns服务器,如果手动更改需要重启网络服务:

sudo /etc/init.d/networking restart

网络配置就告一段落,下面是ftp的配置。

二、ubuntu VSFTP服务配置

ftp服务我们用的是开源软件vsftp,可以通过下面命令安装:

sudo apt-get install vsftp

安装完毕后可以通过下面命令管理vsftp服务:

sudo /etc/init.d/vsftp start|stop|restart

首先,我们先明确一下使用ftp的目的,本文是为了方便对ubuntu的管理,上传网站文件,拷贝文件,而且是内部使用,所以我们这里让vsftp开启本地用户登录和上传,并把默认的权限修改为当前用户可读写并可执行的:

sudo vi /etc/vsftpd.conf

里面的配置文件需要修改的地方有:

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES      
#
# Uncomment this to allow local users to log in.
local_enable=NO      
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022

…………

#

# Uncomment this to allow the anonymous FTP user to upload files. This only

# has an effect if the above global write enable is activated. Also, you will

# obviously need to create a directory writable by the FTP user.

anon_upload_enable=YES

#

# Uncomment this if you want the anonymous FTP user to be able to create

# new directories.

anon_mkdir_write_enable=YES

#

# other write allowed such as delete.

anon_other_write_enable=YES

修改完毕,重启vsftp服务:

sudo /etc/init.d/vsftpd restart

* Stopping FTP server: vsftpd                                            [ OK ]
* Starting FTP server: vsftpd                                             [ OK ]

然后就可以通过ftp客户端访问ubuntu的ftp服务了,vsftp默认匿名用户目录为/srv/ftp,该目录必须是755的权限(sudo chmod 755 /srv/ftp),在其下可以新建ftp:ftp有修改权限的目录下即可完成上传、下载、更改、新建目录、删除等操作。

总结

        本文介绍了ubuntu Server 9.04的网络配置和ftp服务的架设话题,希望能对初次接触ubuntu的新手有所帮助。