Skip to main content

Posts

Showing posts with the label Subnetting

PowerShell Test Port Forwarding

Port forwarding is necessary if the device is that needs to connect to the unsecured world of the Internet.
Of course, before opening port or doing any port forwarding make sure that security is in place. Firewall rules, software configuration are properly set, up-to-date anti-virus and other settings that needs to be done to secure the system.
PowerShell can test whether a remote port is open or a Port Forwarding rules on either on the Firewall or router is set correctly.
Here’s a one liner code, to check whether the Port is open or not.
Both one line code below does the same thing, check whether the Port is open or not.
1 . New-Object System.Net.Sockets.TCPClient -ArgumentList "Remote.Public.IP.Address", 3389
2. Test-NetConnection -Port 80 -InformationLevel Detailed

Replace the port number, with any port number to be tested.
If the connected property on the displayed output is true, then the port is open.

More details on the link below: https://technet.microsoft.com/en-us/lib…

Get network interfaces description in Windows

Netsh is a command line tool that is very useful provided of course you know exactly on how to use it.
Below is an example on how to display the GUID and the description of the network interface card.
   netsh trace show interfaces
Sample output: Ethernet adapter Ethernet: Description:Intel(R) I350 Gigabit Network Connection Interface GUID:{1C8DC74A-0BCD-48FF-F3B7-26B1FF4D5650} Interface Index: 12 Interface Luid:0x8000008000000

Tunnel adapter isatap.{BCF65C9D-CB58-49F7-8BA1-88DBF2A6FBCE}: Description:Microsoft ISATAP Adapter #3 Interface GUID:{F8BB0A84-D5A4-CA93-BA100-27EF2898CC82} Interface Index: 19 Interface Luid:0x12000005000000
The GUID (globally unique identifier) is used to identify objects in Windows registry. The above command shows the description and the interface GUID, but the above command also can be used to sniff or capture traffic.
netsh trace start capture=YES report=YES persistent=YES
Netsh packet sniffing is quite handy because it's already built-in on the system and no …

PowerShell Get IP Address and Subnet mask

Get IP Address, MAC Address and Subnet mask.

It also displays the CIDR (Classless InterDomain Routing) notation.

Here's the script:
 ======================================

$nic_configuration = gwmi -computer .  -class "win32_networkadapterconfiguration" | Where-Object {$_.defaultIPGateway -ne $null}
$IP = $nic_configuration.ipaddress
write-output " IP Address : $IP"

$MAC_Address = $nic_configuration.MACAddress
write-output " MAC Address :  $MAC_Address"

$SubnetMask = $nic_configuration.ipsubnet


switch ($SubnetMask) {
255.255.255.255   {" Subnet mask is: 255.255.255.255 or /32 "}
255.255.255.254   {" Subnet mask is: 255.255.255.254  or   /31 "}
255.255.255.252   {" Subnet mask is:  255.255.255.252 or   /30 "}
255.255.255.248   {" Subnet mask is: 255.255.255.248 or  /29 "}
255.255.255.240   {" Subnet mask is:   255.255.255.240   or   /28"}
255.255.255.224   {" Subnet mask is:   255.255.255.224   or   /27&q…

Show interface IP Address in Windows 10

Commands below work in Windows 10, I think it will also work in Windows 2012.

Displaying or show IP Address in Windows is quite straight forward using ipconfig /all command.
The command has the /all parameter so it will display the IP Address of all the interfaces on the machine.
Display IP Address of a specific interface in Windows via command line using “netsh” tool.
To display the interface IP Address you need to get the interface name.
Typing the command below will show all the interface name and its state whether its connected or disconnected.
 netsh interface show interface
Sample output: Admin State    State          Type             Interface Name ------------------------------------------------------------------------- Enabled        Connected      Dedicated        Ethernet Enabled        Connected      Dedicated        VMware Network Adapter VMnet1 Enabled        Connected      Dedicated        VMware Network Adapter VMnet8 Enabled        Connected      Dedicated        Wi-Fi …

Enable ICMP or Ping request on Windows

If you ping a remote computer but fails, it could be that the firewall does not allow ICMP protocol.

Enabling ICMP or ping requests is quite useful for troubleshooting purposes but it could be also a security issue.
To enable ping or ICMP in Windows Firewall with Advance security, can be done via command line or using the graphical interface.
Command line is quite useful if the setting has to be done repeatedly or it has to be done on multiple machines.
Command line will also be helpful if a setting has to be enabled or disabled at times. Graphical interface is of course the easiest method if it has to be done one time but if the setting has to be done a couple of times then command line or scripting is definitely a good choice unless the person loves to click and click.
Enable Ping response using command line: netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow
Disable Ping response using command line: net…

JunOS DHCP set MAC or static binding

How to set a static binding in JunOS? How to set a reservation of MAC address in DHCP? How to configure DHCP manual bindings? Different ways of asking on how to do but only one  specific goal, to assign an IP Address to a specific MAC or hardware. In JunOS SRX firewalls type this command: set system services dhcp static-binding 01:02:03:09:0A:0B fixed-address 192.168.1.1 IP Address of 192.168.1.1 will be assigned to a device with this MAC or hardware identifier of 01:02:03:09:0A:0B . See reference below for more details: http://www.juniper.net/documentation/en_US/junos12.1/topics/example/security-device-dhcp-server-configuring.html To do a reservation of MAC Address on Windows see below: Using Windows GUI see this link: https://technet.microsoft.com/en-us/library/dd759190.aspx The GUI instruction may change from version of the operating system but the logic on how to do it stays the same, you need to know the MAC address which will serve as an identifier so DHCP will know what IP Address will be …