Пример #1
0
        public static void Main(string[] args)
        {
            ///設定 POOL
            //192.168.101.0/24 (192.168.101.0-192.168.101.255)
            Dictionary <Subnet, DhcpLink> linkMap = new Dictionary <Subnet, DhcpLink>();
            Subnet v6subnet = new Subnet("fe80::e5dc:c884:7691:5104", 128);
            Subnet v4subnet = new Subnet("192.168.61.0", 24);
            link   v6link   = new link()
            {
                name               = "Local IPv6 Client Link(Multicast traffic)",
                Address            = "",
                v6MsgConfigOptions = new v6ConfigOptionsType()
                {
                    v6DnsServersOption = new v6DnsServersOption()
                    {
                        ipAddress = new List <string>()
                        {
                            "2001:b000:168::1"
                        }
                    }
                },
                v6NaAddrPools = new List <v6AddressPool>()
                {
                    new v6AddressPool()
                    {
                        range = "2001:b030:1128:161:0:0:1:1-2001:b030:1128:161:0:0:1:200"
                    }
                }
            };
            link v4link = new link()
            {
                name            = "IPv4 Client Link 1",
                Address         = "192.168.61.0/24",
                v4ConfigOptions = new v4ConfigOptionsType()
                {
                    v4SubnetMaskOption = new v4SubnetMaskOption()
                    {
                        ipAddress = "255.255.255.0"
                    },
                    v4RoutersOption = new v4RoutersOption()
                    {
                        ipAddress = new List <string>()
                        {
                            "192.168.61.254"
                        }
                    }
                },
                v4AddrPools = new List <v4AddressPool>()
                {
                    new v4AddressPool()
                    {
                        range = "192.168.61.1-192.168.61.240"
                    }
                }
            };

            linkMap[v6subnet] = new DhcpLink(v6subnet, v6link);
            linkMap[v4subnet] = new DhcpLink(v4subnet, v4link);
            config.SetLinkMap(linkMap);

            v6ServerIdOption dhcpServerId = new v6ServerIdOption();

            dhcpServerId.opaqueData.asciiValue = "000100011dd31327001dbac1557b";
            config.SetV6ServerIdOption(dhcpServerId);

            //StartV4Test();
            //V6Solicit();
            //V6Request();
            //V6Release();
            // new DhcpServer().Start();
            Console.Read();
        }
Пример #2
0
 public DhcpV6ServerIdOption(v6ServerIdOption serverIdOption)
     : base(serverIdOption)
 {
     SetCode(DhcpConstants.V6OPTION_SERVERID);
 }