1. 服务器网卡配置文件

/etc/sysconfig/network/ifcfg-***(eth0)

  1. linux-f1s9:/etc/sysconfig/network # cat ifcfg-eth0
  2. BOOTPROTO='static'
  3. BROADCAST=''
  4. ETHTOOL_OPTIONS=''
  5. IPADDR='10.148.128.200/24'
  6. MTU=''
  7. NAME='Broadcom Ethernet controller'
  8. NETWORK=''
  9. REMOTE_IPADDR=''
  10. STARTMODE='auto'
  11. USERCONTROL='no'

配置说明:

  1. BOOTPROTO=static 网卡获得ip地址的方式
                      Static(静态 ip地址)
                      dhcp(通过dhcp协议获取ip
                      bootip通过bootp协议获得的ip地址
  2. BROADCAST=192.168.0.255 子网广播地址
  3. HWADDR=:::8E::EE 网卡物理地址
  4. IPADDR=12.168.1.117 网卡IP地址
  5. IPV6INIT=no 是否启用IPV6
  6. IPV6_AUTOCONF=no
  7. NETMASK=255.255.255.0 网卡对应网络掩码
  8. NETWORK=192.168.1.0 网卡对应的网络地址
  9. ONBOOT=yes 系统启动时是否设置此网络接口,设置为yes时,系统启动时激活此设备。默认设置为yes

备注:IP netmask有以下两种写法:

    1.  IPADDR='10.148.128.200/24'     (合并)

    2.  IPADDR='10.148.128.200'       NETMASK=255.255.255.0  (分开)

     如果两种写法都存在,'10.148.128.200/24'  方式优先级更高。

2. 后台Shell脚本

2.1 获取IP信息

此处是通过ifconfig -a命令截取,当网卡名比较长的时候网卡名称实际上是显示不完整的。

  1. #!/bin/bash
  2. #########################################
  3. #SCRIPT: getIPInfo.sh
  4. #PLATFORM: Not platform dependent
  5. #PURPOSE:获取网卡信息
  6. #########################################
  7. cd `dirname $`
  8. ipinfo=host_ip_info.properties
  9. logFile=/srv/ftpd/log/iptool.log
  10. dealedCard=""
  11.  
  12. function toInfoLog()
  13. {
  14. echo "$(date +%Y-%m-%d) $(date +%H:%M:%S) INFO:$@" >> $logFile
  15. }
  16.  
  17. if [ -f $ipinfo ]; then
  18. rm -f $ipinfo
  19. fi
  20.  
  21. # 只显示网卡配置文件中的IP,不显示IP映射的监听IP。根据":v" 过滤,
  22. netcards=`/sbin/ifconfig -a | awk '/Link encap:Ethernet/{print $1}'|grep -v ":v"`
  23. for ncard in ${netcards}
  24. do
  25. flag=$(echo ${dealedCard}|grep ${ncard})
  26. if [ "X$flag" != "X" ]
  27. then
  28. toInfoLog "read same netcard $ncard."
  29. continue
  30. fi
  31. dealedCard="${dealedCard} $ncard"
  32. # web界面无法显示通过yast新增的IP地址(网卡名称过长)
  33. ips=`/sbin/ifconfig -a |grep "${ncard} " -A | awk -F: '/inet addr:/{print $2}' | awk '{print $1}'`
  34. masks=`/sbin/ifconfig -a |grep "${ncard} " -A | awk -F: '/Mask:/{print $4}'`
  35. count=
  36. for ip in $ips
  37. do
  38. count=`expr $count + `
  39. mask=$(echo $masks |cut -d' ' -f $count)
  40. toInfoLog "$ncard $ip/${mask}"
  41. #记录网卡IP信息
  42. echo "$ncard $ip/${mask}" >> $ipinfo
  43. done
  44.  
  45. done

2.1  虚拟IP新增/删除操作

  1. #!/bin/bash
  2. #########################################
  3. #SCRIPT: config_sysvirtual_ip.sh
  4. #PLATFORM: Not platform dependent
  5. #PURPOSE: [新增]或[删除]虚拟ip
  6. #参数列表: $ 操作类型(add|del)
  7. # $ 虚拟ip
  8. # $ 掩码(例:)
  9. # $ 网卡名
  10. #例如:./config_sysvirtual_ip.sh mode 10.10.10.1 (255.255.255.0) eth0
  11. #########################################
  12. FULL_PATH=$
  13. PATH_BIN=${FULL_PATH%%/config_sysvirtual_ip.sh*}
  14. cd $PATH_BIN
  15.  
  16. mode=$;
  17. ip=$;
  18. mask=$
  19. netcard=$;
  20. net_name=`echo $netcard|awk -F: '{print $1}'`
  21. logFile=/srv/ftpd/log/iptool.log
  22.  
  23. function toInfoLog()
  24. {
  25. echo "$(date +%Y-%m-%d) $(date +%H:%M:%S) INFO:$@" >> $logFile >&
  26. }
  27.  
  28. function toErrorLog()
  29. {
  30. echo "$(date +%Y-%m-%d) $(date +%H:%M:%S) ERROR:$@" >> $logFile >&
  31. }
  32.  
  33. # function get_netfile()
  34. # {
  35. # netcard=$
  36. # net=`echo $netcard|awk -F: '{print $1}'`
  37. # netdir="/etc/sysconfig/network"
  38. # netfile="$netdir/ifcfg-$net"
  39. # echo $netfile
  40. # }
  41.  
  42. function get_newlable()
  43. {
  44. tmp_lable=;
  45. flag=;
  46. #web添加的label号可能与YAST修改过的别名冲突。
  47. #lable_list=`cat $net_cfgfile| grep LABEL|awk -F= '{print $2}'| awk -F\' '{print $}'`
  48. lable_list=`cat $net_cfgfile| grep LABEL|awk -F= '{print $1}'| awk -F_ '{print $2}'`
  49.  
  50. if [ -z "$lable_list" ]; then
  51. new_lable=;
  52. flag=;
  53. else
  54. for lable in $lable_list; do
  55. if [ $lable -ge $tmp_lable ]; then
  56. tmp_lable=$lable;
  57. fi
  58. done
  59. fi
  60. if [ $flag -eq ];then
  61. new_lable=$(($tmp_lable+))
  62. fi
  63. echo "$tmp_lable $lable_list"
  64. echo "new virtual ip_lable =$new_lable"
  65. }
  66.  
  67. function valid_ip()
  68. {
  69. for used_ip in `ifconfig | awk -F'addr:|Bcast' '/Bcast/{print $2}'`; do
  70. if [ $used_ip = "$ip" ]; then
  71. echo "exited ip $ip"
  72. exit
  73. fi
  74. done
  75. echo "valid ip"
  76. }
  77.  
  78. function add_ip()
  79. {
  80. valid_ip;
  81. get_newlable;
  82. if [ $? -eq ]; then
  83. echo "exited ip"
  84. exit
  85. fi
  86.  
  87. /sbin/ifconfig $net_name:$new_lable $ip_mask
  88. if [ $? -eq ]; then
  89. sed -i "$ a\LABEL_$new_lable='w$new_lable'" $net_cfgfile
  90. sed -i "$ a\IPADDR_$new_lable='$ip_mask'" $net_cfgfile
  91. echo "set virtual ip $ip_mask to $net_name:$new_lable"
  92. /sbin/rcnetwork restart $net_name
  93. else
  94. echo "Wrong parameters"
  95. exit ;
  96. fi
  97. }
  98.  
  99. function del_ip()
  100. {
  101. #grep \'${ip}[\/\'] IP之后以\或'结尾。兼容IPADDR_1='3.3.3.3/24' 和IPADDR_1='3.3.3.3'
  102. lable=`cat $net_cfgfile|grep \'${ip}[\/\']| awk -F= '{print $}'|awk -F_ '{print $}'`
  103. if [ -n "$lable" ];then
  104. #LABEL_X='Y' 通过yast操作过以后X会重排,X和Y不一定相等。其次IPADDR_label ip/mask不一定是在一行。
  105. sed -i "/^ *LABEL_$lable=/d" $net_cfgfile;
  106. sed -i "/IPADDR_$lable='$ip/d" $net_cfgfile;
  107. # 删除对应可能存在的NETMASK行
  108. sed -i "/NETMASK_$lable='/d" $net_cfgfile;
  109. echo "delet ip: ${net_name}:w${lable} ${ip_mask}. rntCode=$?"
  110. /sbin/rcnetwork restart $net_name
  111. else
  112. echo "Cannot del:no exits valid ip"
  113. exit ;
  114. fi
  115. }
  116.  
  117. # begin
  118. # 校验IP和netmask有效性 ,略
  119.  
  120. net_cfgfile="/etc/sysconfig/network/ifcfg-$net_name"
  121. ip_mask=$ip/$mask
  122. new_lable=;
  123.  
  124. if [ $# -eq -a -f $net_cfgfile ]; then
  125. if [ $mode = "add" ];then
  126. toInfoLog "add ip begin"
  127. add_ip $mode $ip $long_mask $net_name >> $logFile >&
  128. elif [ $mode = "del" ];then
  129. toInfoLog "delete ip begin"
  130. del_ip $mode $ip $long_mask $net_name >> $logFile >&
  131. else
  132. toErrorLog "Usage. $0 <add|del> <ip> <netmask> <netcard>"
  133. exit ;
  134. fi
  135. else
  136. toErrorLog "Usage. $0 <add|del> <ip> <netmask> <netcard>"
  137. exit ;
  138. fi

2.2 IP修改操作

修改操作可能会影响原有业务,除了修改网卡配置文件之外,还需要同步更新相关操作系统文件(如:/etc/hosts,/etc/ssh/sshd_config, /etc/vsftpd.conf等文件)中该IP信息。

入口:

  1. #!/bin/bash
  2. #########################################
  3. #SCRIPT: modIPInfo.sh
  4. #PURPOSE:修改IP
  5. #########################################
  6. FULL_PATH=$
  7. PATH_BIN=${FULL_PATH%%/modIPInfo.sh*}
  8. cd $PATH_BIN
  9.  
  10. # 记日志统一格式输出
  11. function toInfoLog()
  12. {
  13. echo "$(date +%Y-%m-%d) $(date +%H:%M:%S) INFO:$@"
  14. }
  15.  
  16. # 备份文件
  17. function backup_proc()
  18. {
  19. toInfoLog "backup files begin..."
  20. backup_restore_file backup $netcard
  21. }
  22.  
  23. # 回退文件
  24. function restore_proc()
  25. {
  26. # 恢复文件即可。
  27. backup_restore_file restore $netcard
  28. #modify_proc $netcard $oldIp $oldmask $newIp $newmask
  29. }
  30.  
  31. # 修改IP
  32. function modify_proc()
  33. {
  34. toInfoLog "modify_proc begin"
  35. # 更新操作系统相关文件 目前只有/etc/hosts
  36. modify_OS_file $oldIp $newIp
  37. # 更新网卡配置文件
  38. modify_net_file $netcard $newIp $newmask $oldIp $oldmask
  39. }
  40.  
  41. # main
  42. function modifiyIP()
  43. {
  44. toInfoLog "mode ip begin"
  45. backup_proc
  46. modify_proc
  47. if [ $? -ne ];then
  48. toInfoLog "modify_net_file failed,restore ip."
  49. restore_proc $netcard $oldIp $oldmask $newIp $newmask
  50. exit
  51. fi
  52. toInfoLog "modifiyIP $newIp success."
  53. }
  54.  
  55. # begin
  56. if [ $# -ne ]
  57. then
  58. echo "Usage. $0 <netcard> <newIp> <newmask(24)> <oldIp> <oldmask(24)>"
  59. exit
  60. fi
  61. netcard=$
  62. newIp=$
  63. newmask=$
  64. oldIp=$
  65. oldmask=$
  66.  
  67. log_file=/srv/ftpd/log/iptool.log
  68.  
  69. . /opt/tool/iptool/modIPInfoUtil.sh
  70. modifiyIP >> ${log_file} >&

修改方法

  1. #!/bin/bash
  2. #########################################
  3. #SCRIPT: modIPInfoUtil.sh
  4. #PLATFORM: Not platform dependent
  5. #PURPOSE: 修改IP
  6. #参数列表:
  7. #params:netcard newip newmask oldip oldmask
  8. #########################################
  9.  
  10. filebackupPath=/opt/tool/iptool
  11.  
  12. # 记日志统一格式输出
  13. function toInfoLog()
  14. {
  15. echo "$(date +%Y-%m-%d) $(date +%H:%M:%S) INFO:$@"
  16. }
  17. function toErrorLog()
  18. {
  19. echo "$(date +%Y-%m-%d) $(date +%H:%M:%S) ERROR:$@"
  20. }
  21.  
  22. function bak_restore_file()
  23. {
  24. mode=$
  25. filename=$
  26. if [ $# != ];then
  27. toErrorLog "bak_restore_file params number error"
  28. exit
  29. fi
  30. fileabs=$(echo $filename |awk -F/ '{print $NF}')
  31. filebackup=${filebackupPath}/${fileabs}_lastBak
  32. if [ $mode = "backup" ];then
  33. if [ -f "${filename}" ];then
  34. cp -rfp $filename $filebackup
  35. if [ $? = ];then
  36. toInfoLog "backup $filename success"
  37. else
  38. toErrorLog "backup $filename fail"
  39. exit
  40. fi
  41. fi
  42. elif [ $mode = "restore" ];then
  43. if [ -f "$filebackup" ];then
  44. cp -rfp $filebackup $filename
  45. if [ $? = ];then
  46. toInfoLog "restore $filename success"
  47. else
  48. toErrorLog "restore $filename fail"
  49. exit
  50. fi
  51. fi
  52. fi
  53.  
  54. }
  55.  
  56. function get_netfile()
  57. {
  58. netcard=$
  59. net=`echo $netcard|awk -F: '{print $1}'`
  60. netdir="/etc/sysconfig/network"
  61. netfile="$netdir/ifcfg-$net"
  62. echo $netfile
  63. }
  64.  
  65. function bak_restore_OS_file()
  66. {
  67. mode=$
  68. netcard=$
  69. #备份网卡信息
  70. netfile=`get_netfile $netcard`
  71. toInfoLog "netfile= $netfile"
  72. bak_restore_file $mode $netfile
  73.  
  74. bak_restore_file $mode /etc/hosts
  75. # bak_restore_file $mode /etc/vsftpd.conf
  76.  
  77. #备份dns文件
  78. # bak_restore_file $mode /etc/resolv.conf
  79. # bak_restore_file $mode /etc/named.conf
  80. }
  81.  
  82. function backup_restore_file()
  83. {
  84. mode=$
  85. netcard=$
  86. bak_restore_OS_file $mode $netcard
  87. }
  88.  
  89. #判断ip是否存在,exist——存在,notexist——不存在
  90. function check_file_status()
  91. {
  92. file=$
  93. ip=$
  94. filter=`cat $file|grep $ip`
  95.  
  96. if [ "X$filter" != "X" ];then
  97. echo "exist"
  98. else
  99. echo "notexist"
  100. fi
  101. }
  102.  
  103. #文件存在ip才进行替换,替换后判断新ip是否存在,不存在替换失败
  104. function replaceIP()
  105. {
  106. oldIp=$
  107. newIp=$
  108. file=$
  109. result=`check_file_status $file $oldIp`
  110.  
  111. toInfoLog "replaceIP $file $oldIp $result"
  112. if [ $result = "exist" ];then
  113. toInfoLog "replaceIP $file oldIp=$oldIp ,newIp=$newIp "
  114. sed -i 's/'${oldIp}'/'${newIp}'/g' $file
  115. result=`check_file_status $file $newIp`
  116. if [ $result = "notexist" ];then
  117. toErrorLog "replace $file $oldIp to $newIp failed"
  118. return
  119. fi
  120. fi
  121. }
  122.  
  123. function modify_net_file()
  124. {
  125. netcard=$
  126. newIp=$
  127. newmask=$
  128. oldIp=$
  129. oldmask=$
  130.  
  131. #备份网卡信息
  132. netfile=`get_netfile $netcard`
  133.  
  134. result=`check_file_status $netfile \'${newIp}[\/\']`
  135. if [ $result = "exist" ];then
  136. toErrorLog "newIp ${newIp} aready exist, modip failed"
  137. return
  138. fi
  139.  
  140. new_ip_mask=${newIp}\/${newmask}
  141. toInfoLog "new_ip_mask=$new_ip_mask ,old_ip_mask=${oldIp}/${oldmask}"
  142. # 替换匹配模式兼容IP/mask 和IP、mask分行(预装环境)的情况 .'${oldIp}[\/\'].* 精确匹配,以防误修改。
  143. sed -i "s/'${oldIp}[\/\'].*/'${newIp}\/${newmask}'/g" $netfile
  144. result=`check_file_status $netfile $new_ip_mask`
  145. if [ $result = "notexist" ];then
  146. toErrorLog "replace ip failed"
  147. return
  148. fi
  149. toInfoLog "replace ip ok. network restart..."
  150. net=`echo $netcard|awk -F: '{print $1}'`
  151. /sbin/rcnetwork restart $net
  152. }
  153.  
  154. #查找文件是否存在ip
  155. check_OS_file()
  156. {
  157. ip=$
  158. check_file_status /etc/ssh/sshd_config $ip
  159. check_file_status /etc/hosts $ip
  160. check_file_status /etc/my.cnf $ip
  161. check_file_status /etc/vsftpd.conf $ip
  162. #dns
  163. check_file_status /var/lib/named/tdtech.com $ip
  164. check_file_status /etc/resolv.conf $ip
  165. check_file_status /etc/named.conf $ip
  166. }
  167.  
  168. # 修改IP时更新sshd_config对应IP 暂不用
  169. function modify_OS_file()
  170. {
  171. oldIp=$
  172. newIp=$
  173. replaceIP $oldIp $newIp /etc/hosts
  174. #sshd 暂不涉及
  175. # replaceIP $oldIp $newIp /etc/ssh/sshd_config
  176. # if [ -n "`service sshd status |grep running`" ]
  177. # then
  178. # service sshd restart
  179. # fi
  180.  
  181. #vsftp 暂不涉及
  182. # replaceIP $oldIp $newIp /etc/vsftpd.conf
  183. # if [ -n "`service vsftpd status |grep running`" ]
  184. # then
  185. # service vsftpd restart
  186. # fi
  187.  
  188. #db 暂不涉及
  189. # replaceIP $oldIp $newIp /etc/my.cnf
  190. # /opt/UBP/bin/modifydb_ip.sh $oldIp $newIp
  191.  
  192. #dns
  193. # replaceIP $oldIp $newIp /var/lib/named/tdtech.com
  194. # replaceIP $oldIp $newIp /etc/resolv.conf
  195. # replaceIP $oldIp $newIp /etc/named.conf
  196. }

2.3  修改网关

比较简单,根据传入的参数更新文件/etc/sysconfig/network/routes并重启网卡。

  1. #!/bin/bash
  2. #########################################
  3. #SCRIPT: updateGateway.sh
  4. #PLATFORM: Not platform dependent
  5. #PURPOSE: 修改Gateway
  6. #参数列表:
  7. #########################################
  8. FULL_PATH=$
  9. PATH_BIN=${FULL_PATH%%/updateGateway.sh*}
  10. cd $PATH_BIN
  11.  
  12. oldGateWay=$
  13. gatewayAddr=$
  14. gatewayfile=/etc/sysconfig/network/routes
  15. Logfile=IPConfig.log
  16.  
  17. function toInfoLog()
  18. {
  19. echo "$(date +%Y-%m-%d) $(date +%H:%M:%S) INFO:$@"
  20.  
  21. }
  22. function toErrorLog()
  23. {
  24. echo "$(date +%Y-%m-%d) $(date +%H:%M:%S) ERROR:$@"
  25. }
  26. #检查
  27. function checkGateway()
  28. {
  29. if [ "X${gatewayAddr}" = "X" ]
  30. then
  31. toErrorLog "gatewayAddr null."
  32. exit
  33. fi
  34. if [ "${oldGateWay}" = "${gatewayAddr}" ]
  35. then
  36. echo "mod gatewayAddr is same as before."
  37. exit
  38. fi
  39. }
  40.  
  41. function modGateway()
  42. {
  43. checkGateway
  44. toInfoLog "begin update gateway."
  45. # 备份
  46. cp ${gatewayfile} ${gatewayfile}_bak
  47. cat ${gatewayfile} >> ${Logfile}
  48. # 修改
  49. echo "default ${gatewayAddr} - -" > ${gatewayfile}
  50. if [ $? -ne ]
  51. then
  52. cp ${gatewayfile}_bak ${gatewayfile}
  53. toErrorLog "update ${gatewayfile} failed."
  54. exit
  55. fi
  56. # 重启
  57. service network restart
  58. if [ $? -ne ]
  59. then
  60. cp ${gatewayfile}_bak ${gatewayfile}
  61. service network restart
  62. toErrorLog "update ${gatewayfile} failed when restart."
  63. exit
  64. fi
  65. toInfoLog "update gateway success. ${gatewayAddr}"
  66. }
  67.  
  68. modGateway >> ${Logfile} >&

3. 前端配置页面

为了方便配置,web页面中提供IP配置功能,后台配置的修改由上述Shell脚本完成。

服务器IP配置功能实现小结的更多相关文章

  1. 配置DNS服务器IP

    #############################脚本功能及说明#################### #该脚本用来在本地服务器上配置DNS服务器IP #创建时间:2014-10-22 ## ...

  2. 一个服务器上面配置多个IP ,实现指定IP的域名请求

    //配置多个IP命名using System.Net; //********************************************************************** ...

  3. 主流品牌服务器(Dell、HP、IBM)远程管理卡IP配置参考

    版权声明:个人网络收集整理,欢迎转载! https://blog.csdn.net/niufenger/article/details/80737878 ※Dell服务器iDRAC IP配置 ※HP服 ...

  4. 【Linux服务器双IP配置】如何实现不同IP的双网卡同时上网?

    一.环境和知识预备 我遇到问题的生产机器是CentOS release 6.8系统,不过这并不影响问题的解决,本质上都是一样的. 网关:一个网络连接到另一个网络的关口,也就是实现网络互连,俗称网络连接 ...

  5. Windows服务器无法配置IP

    前天在给一台服务器配置IP地址的时候发现一个奇怪的问题.IP地址配置之后不生效,还是使用的169.254这个微软保留自动分配地址.由于这个是一台虚拟机,尝试了删除添加网卡也没有用.配置IP不成功的时候 ...

  6. 新版raspbian系统的固定IP配置和启用root账户的ssh登录功能的方法

    1. 2016新版raspbian系统的固定IP配置: 自2016年2月份新版raspbian系统发布以后,树莓派的固定IP配置方法就与之前不一样了. 之前在raspbian系统中编辑/etc/net ...

  7. Nginx服务器中配置非80端口的端口转发方法详解

    这篇文章主要介绍了Nginx服务器中配置非80端口的端口转发方法详解,文中使用到了Nginx中的proxy_pass配置项,需要的朋友可以参考下 nginx可以很方便的配置成反向代理服务器: 1 2 ...

  8. NFS服务器+客户端配置

    NFS:Network File System 使用NFS需要启用RPC(remoteprocedure call),RPC可以指定每个NFS功能所对应的端口号,重启RPC后,RPC所管理的所有NFS ...

  9. nginx入门篇----nginx服务器基础配置

    1.nginx.conf文件结构...                         #全局块  events{  ...  }  http                      #http块{ ...

随机推荐

  1. CSS Sprites(CSS图像拼合技术)教程、工具集合

    本集合是有一位国外设计师收集整合,并由 oncoding翻译成中文的,感谢他们的辛苦贡献.CSS Sprites技术在国外并不是什么新技术,只不过近两年(尤其08年开始)中国开始流行这个词,大家也开始 ...

  2. flink流的执行大致流程图

  3. 小白 Linux下安装Elasticsearch5.X

    最近做个项目需要使用到 Elasticsearch5 刚接触liunx 遇到了很多问题记录下 以这篇文章为基础 http://www.cnblogs.com/ShawnYuki/p/6818677.h ...

  4. Dubbo的底层实现原理和机制

    –高性能和透明化的RPC远程服务调用方案 –SOA服务治理方案 Dubbo缺省协议采用单一长连接和NIO异步通讯, 适合于小数据量大并发的服务调用,以及服务消费者机器数远大于服务提供者机器数的情况

  5. sql(10) sum

    SUM() 函数SUM 函数返回数值列的总数(总额).SQL SUM() 语法SELECT SUM(column_name) FROM table_name新建表 StudentSS_id Grade ...

  6. yii2 vendor/bower/jquery/dist not exist

    查看 vendor 文件夹,只有bower-asset文件夹 手动修改 bower-asset 为bower 倒也可以,yii2项目每次 composer install 成功之后,每次重命名这个文件 ...

  7. CF698F Coprime Permutation

    题意:求有多少种符合要求的排列满足对于所有i,j,当gcd(i,j)=1时,gcd(pi,pj)=1. 排列上的一些位置给出. 标程: #include<bits/stdc++.h> us ...

  8. Erlang学习记录:转义

    转义 转义序列 含义 整数编码 \b 退格符 8 \d 删除符 127 \e 换码符 27 \f 换页符 12 \n 换行符 10 \r 回车符 13 \s 空格符 32 \t 制表符 9 \v 垂直 ...

  9. hibernate_03_hibernate一对多的关系映射

    1.实体类的一对多的关系映射 一个客户对应多个联系人 Customer.java public class Customer { private Long cust_id; private Strin ...

  10. 命令学习_ping

    PING: ping是一个所有操作系统都支持的简单工具.我么可以利用ping来解析DNS 的A record和PTRrecord. A记录是将域名映射到IP地址,这个是ping的缺省功能, ping同 ...