所用IP是dhcp服务器自动分配的IP地址,每次要使用开发板的IP都很麻烦,更麻烦的是每次还要在代码里改IP。要是有个路由器也好解决,给这个端口固定一个IP地址,而我恰恰是用的交换机还是没办法配置的那种交换机。那就只能通过命令行改IP地址。
一般有两改法:
一、直接配置网口IP地址和掩码
ifconfig eth0 10.150.11.2 netmask 255.254.0.0
在使用命令source命令进行同步,再通过ifconfig查看IP地址,此时地址改成功了。但这种改法也是很麻烦的,每次重启、开机后都得改。
(解释下source:
在linux下man source得到如下解释:
source filename [arguments]
Read and execute commands from filename in the current shell environment and return the exit status ofthe last command executed from filename. If filename does not contain a slash, filenames in PATH areused to find the directory containing filename. The file searched for in PATH need not be executable.
When bash is not in posix mode, the current directory is searched if no file is found in PATH. If thesourcepath option to the shopt builtin command is turned off, the PATH is