netconfig的问题?
时间:2004-04-11
来源:互联网
执行ifconfig eth0 一看没有改成功。
可是主机名变了 我又看了一下rc.inet1我设置的IP地址在里面,可是我没看见Gateway等设置。
resolv.conf里也有我配置好的DNS
我用ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up
就能临时改
怎么回事呀?
作者: 红毛 发布时间: 2004-04-11
作者: kite 发布时间: 2004-04-11
作者: windrose 发布时间: 2004-04-11
我就问一下我用netconfig怎么没配置上呢?
在文件中如何配置 谢谢!
作者: 红毛 发布时间: 2004-04-11
作者: windrose 发布时间: 2004-04-11
可是我在rc.inet1里有我配置好的IP地址
我配置的Gateway等都没有。
作者: 红毛 发布时间: 2004-04-12
作者: 红毛 发布时间: 2004-04-14
作者: windrose 发布时间: 2004-04-14
# /etc/rc.d/rc.inet1
# This script starts up the base networking system.
#
# Version:
# @(#)/etc/rc.d/rc.inet1 8.1 Tue May 28 15:27:39 PDT 2002 (pjv)
# Edit these values to set up your first Ethernet card (eth0):
IPADDR="192.168.1.6" # REPLACE with YOUR IP address!
NETMASK="255.255.255.0" # REPLACE with YOUR netmask!
# Or, uncomment the following lines to set up eth0 using DHCP:
#USE_DHCP=yes
# If your provider requires a DHCP hostname, uncomment and edit below:
#DHCP_HOSTNAME="CCHOSTNUM-A"
# Edit these values to set up your second Ethernet card (eth1),
# if you have one. Otherwise leave it configured to 127.0.0.1,
# or comment it out, and it will be ignored at boot.
IPADDR2="127.0.0.1" # REPLACE with YOUR IP address!
NETMASK2="255.255.255.0" # REPLACE with YOUR netmask!
# Or, uncomment the following lines to set up eth1 using DHCP:
#USE_DHCP2=yes
# If your provider requires a DHCP hostname, uncomment and edit below:
#DHCP_HOSTNAME2="CCHOSTNUM-A"
# Edit the next line to point to your gateway:
GATEWAY="192.168.1.1" # REPLACE with YOUR gateway!
# You shouldn't need to edit anything below here.
# Set up the loopback interface:
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
# Set up the eth0 interface:
if [ "$USE_DHCP" = "yes" ]; then # use DHCP to set everything up:
echo "Attempting to configure eth0 by contacting a DHCP server..."
# Add the -h option to the DHCP hostname:
if [ ! "$DHCP_HOSTNAME" = "" ]; then
DHCP_HOSTNAME="-h $DHCP_HOSTNAME"
fi
/sbin/dhcpcd -t 10 ${DHCP_HOSTNAME} -d eth0
elif [ ! "$IPADDR" = "127.0.0.1" -a ! "$IPADDR" = "" ]; then # set up IP statically:
# Determine broadcast and network addresses from the IP address and netmask:
BROADCAST=`/bin/ipmask $NETMASK $IPADDR | cut -f 1 -d ' '`
NETWORK=`/bin/ipmask $NETMASK $IPADDR | cut -f 2 -d ' '`
# Set up the ethernet card:
echo "Configuring eth0:"
echo "ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}"
/sbin/ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}
# If that didn't succeed, give the system administrator some hints:
if [ ! $? = 0 ]; then
echo "Your eth0 card was not initialized properly. Here are some reasons why this"
echo "may have happened, and the solutions:"
echo "1. Your kernel does not contain support for your card. Including all the"
echo " network drivers in a Linux kernel can make it too large to even boot, and"
echo " sometimes including extra drivers can cause system hangs. To support your"
echo " ethernet, either edit /etc/rc.d/rc.modules to load the support at boot time,"
echo " or compile and install a kernel that contains support."
echo "2. You don't have an ethernet card, in which case you should run netconfig"
echo " and configure your machine for loopback. (Unless you don't mind seeing this"
echo " error...)"
fi
fi # set up eth0
# Set up the eth1 interface:
if [ "$USE_DHCP2" = "yes" ]; then # use DHCP to set everything up:
echo "Attempting to configure eth1 by contacting a DHCP server..."
# Add the -h option to the DHCP hostname:
if [ ! "$DHCP_HOSTNAME2" = "" ]; then
DHCP_HOSTNAME2="-h $DHCP_HOSTNAME2"
fi
/sbin/dhcpcd -t 10 ${DHCP_HOSTNAME2} -d eth1
elif [ ! "$IPADDR2" = "127.0.0.1" -a ! "$IPADDR2" = "" ]; then # set up IP statically:
# Determine broadcast and network addresses from the IP address and netmask:
BROADCAST2=`/bin/ipmask $NETMASK2 $IPADDR2 | cut -f 1 -d ' '`
NETWORK2=`/bin/ipmask $NETMASK2 $IPADDR2 | cut -f 2 -d ' '`
# Set up the ethernet card:
echo "Configuring eth1:"
echo "ifconfig eth1 ${IPADDR2} broadcast ${BROADCAST2} netmask ${NETMASK2}"
/sbin/ifconfig eth1 ${IPADDR2} broadcast ${BROADCAST2} netmask ${NETMASK2}
# If that didn't succeed, give the system administrator some hints:
if [ ! $? = 0 ]; then
echo "Your eth1 card was not initialized properly. Here are some reasons why this"
echo "may have happened, and the solutions:"
echo "1. Your kernel does not contain support for your card. Including all the"
echo " network drivers in a Linux kernel can make it too large to even boot, and"
echo " sometimes including extra drivers can cause system hangs. To support your"
echo " ethernet, either edit /etc/rc.d/rc.modules to load the support at boot time,"
echo " or compile and install a kernel that contains support."
echo "2. You don't have an ethernet card, in which case you should fix"
echo " /etc/rc.d/rc.inet1 to stop trying to configure eth1. (Unless you don't mind"
echo " seeing this error...)"
fi
fi # set up eth1
# Set up the gateway:
if [ ! "$GATEWAY" = "127.0.0.1" -a ! "$GATEWAY" = "" ]; then
/sbin/route add default gw ${GATEWAY} metric 1
fi
# End of /etc/rc.d/rc.inet1
作者: 红毛 发布时间: 2004-04-14
作者: windrose 发布时间: 2004-04-15
我是初学者上来就受到打击了
我在别人的机子一配置就OK
作者: 红毛 发布时间: 2004-04-15
作者: hj_18 发布时间: 2004-04-16
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28