miwaiwai

导航

在三层接口配置vlan以及dhcp&dns下发dls的地址

    public static void main(String[] args) {
        

        // String asciiString = "Siemenssdlp://10.10.30.244:18443"; // 举例一个ASCII字符串
        String asciiString = "\u0001\u0007Siemens\u0003\u001asdlp://10.10.30.244:18443"; // 举例一个ASCII字符串
        char[] asciiChars = asciiString.toCharArray(); // 将字符串转换为字符数组
        StringBuilder hexValue = new StringBuilder(); // 用于存储十六进制字符串
 
        for (char c : asciiChars) {
            int asciiInt = (int) c; // 将字符转换为整数
  
              String hex = Integer.toHexString(asciiInt);// 转换为十六进制
            hex=String.format("%"+2+"s",hex).replace(' ', '0');//格式化输出,缺位补0
            System.out.println(String.format("%"+4+"s",hex).replace(' ', '0'));
            // System.out.println(hex.toString());
            
            hexValue.append(hex); // 追加到结果中
        }

      System.out.println("ASCII string '" + asciiString + "' in hex is: " + hexValue.toString());
    // System.out.println("\0x01");
    // System.out.println("\0x07");
    // System.out.println("\0x03");
      // System.out.println("\0x26");
    }

 

在接口上配置dhcp

dhcp enable
interface Vlanif80
ip address 10.101.2.1 255.255.255.0
dhcp select interface
dhcp server lease day 100 hour 23 minute 0
dhcp server dns-list 10.199.200.72
dhcp server dns-list 10.198.200.72
dhcp server option 43 ascii 01075369656d656e73031A73646C703A2F2F31302E31302E33302E3234343A3138343433 (Siemenssdlp://10.10.30.244:18443 https://www.convertstore.com/number/asciitohex/zh%2fascii-text-to-hex-converter.html)
dhcp server option 43 ascii 01 07 53 69 65 6d 65 6e 73 03 1a 73 64 6c 70 3a 2f 2f 31 30 2e 31 39 39 2e 32 30 30 2e 36 37 3a 31 38 34 34 33

修改arp老化周期
arp expire-time 30(华为,单位为秒)
arp timer aging 1(华三,单位为分钟)

 

 

dhcp配置 以下是全局配置dhcp

dhcp enable
network 10.101.2.0 mask 24
gateway-list 10.101.2.1
dns-list 10.199.200.72
dns-list 10.198.200.72
excluded-ip-address 10.101.2.1
lease day 3
dhcp server option 43 ascii 01075369656d656e73031A73646C703A2F2F31302E31302E33302E3234343A3138343433 下发dls数据
需要在哪个port开启这个服务 以下是全局配置dhcp
nterface Vlan 80
dhcp selece global

 q

 

posted on 2024-12-11 21:36  米歪歪  阅读(26)  评论(0)    收藏  举报