After a failed (dirty) flash to update the version of Chroma I was running on my Nexus 5X, I needed to restore a previous backup. After restoring, I was unable to bypass the lockscreen using my previous pin. The root of this problem is TWRP messing up some encypted files when recovered.
The easy way to fix said issue:
1) Restore from Nandroid Backup
2) Go into ADB and use the following commands:
rm /data/system/locksettings.db
rm /data/system/*.key
3) Boot and voila!
Note, it is recommended for you to restore your pin code afterwords.
Tuesday, January 19, 2016
Friday, January 8, 2016
Simple Networking Exercise
The Why:
My work asked me to create this set up and document it for them. Well, now that I am finished, it contains many useful commands and such, so I am posting it on here for easy reference.Layout:
The Cisco Switch (192.168.2.1) has 2 Ethernet cables leaving it from ports fa0/3 and fa0/4. Fa0/3 goes to the Linux box (192.168.2.2), while fa0/4 goes to the Macbook (192.168.2.3). Then, an additional connection is made from the XPS (192.168.1.2) and the Linux Box (192.168.1.1).Network Components and Software:
Dell XPS 13 running Windows 10 ProLinux Box: Old PC running Ubuntu Server 14.04
15" MacBook Pro Late 2013 running OS El Capitan
Cisco 3550 Layer 3 Switch
Setting Up Dell XPS 13:
Open command prompt as an admin, and type these commands:netsh interface ip set address "Ethernet" static 192.168.1.2
255.255.0.0 192.168.1.1
route ADD 192.168.2.0 MASK 255.255.255.0 192.168.1.1
And that is it for the laptop. The first command gives "Ethernet" (the desired network interface) a static IP and points the default gateway to the Linux Box. The second command routes all traffic sent to 192.168.2.x to 192.168.1.1 (Linux Box) which will act as a gateway.
Setting Up Macbook Pro:
Go to System Preferences -> Network. Then assign the following settings to your interface (in my case, Ethernet):Configure IPv4: Manually
IP Address: 192.168.2.3
Subnet Mask: 255.255.0.0
Router: 192.168.2.1
This assigns your interface a static IP and tells it to look at the switch for its default gateway.
Setting Up the Cisco 3550 Switch:
I used ZTerm on the MacBook to connect to the switch. First, you need to make sure your settings arecorrect. Go to Settings->Connection... . Then, make sure your settings look similar to this:
Data Rate: 9600 Data Bits: 8 Parity: None Stop Bits: 1
After that, go to Settings->Modem Preferences and make sure serial port is pointing to your DB-9
adapter (often just called usbserial). Plug in your switch and the ZTerm canvas should start showing post information.
After booting, you might want to create a vlan. I did this because previous settings were still on the
switch, and I didn't want to alter them (read as I couldn't figure what was changed between factory and now). To create a VLAN*:
Switch>enable Switch# config terminal
Switch(config)# vlan 2
Switch(config-vlan)# name vlan2
Switch(config-vlan)# end
*Note: "Before creating vlan, switch must be in VTP server mode or VTP transparent mode. If the switch is a VTP server, you must define a VTP domain before you can add any VLANs," (Cisco). My switch was already set up as VTP transparent, however the link provides more information if necessary.
Now to configure the VLAN. All I did to configure it was give it an static IP so it can be the default gateway. These are the commands I used to configure the VLAN:
Switch>enable
Switch# config terminal
Switch(config)# interface vlan2
Switch(config-if)# ip address 192.168.2.1 255.255.0.0
Switch(config-if)# exit
Next, you must add interfaces to the VLAN. I originally added 3 interfaces for testing purposes, however you should only need 2. To add an interface:
Switch>enable
Switch# config terminal
Switch(config)# interface fa0/3
Switch(config-if)# switchport access vlan2
Switch(config-if)# switchport mode access
Switch(config-if)# exit
You can swap fa0/3 for the interfaces you want. I used fa0/3, fa0/4, and fa0/5.
Set up Linux Router/Firewall:
*Note: I used a clean install of Ubuntu Server 14.04, with no extra services or roles installed.Because this machine is not connected to the internet, I had to mount an ISO off of a flash drive in order to install roles/ services necessary. This step is optional depending on your situation.
sudo mount -t vfat /dev/sdb1 /media/usb/
sudo mount -o loop /media/usb/isofilename.iso /media/cdrom/
First thing to do is install iptables. You can do so with the following command:
sudo apt-get install iptables
I also installed vim at this step, since it is my preferred Unix cli editor. This is optional.
sudo apt-get install vim
After these are installed, it is necessary to set up static IPs for the NICs. To do so, it is necessary to alter the "interfaces" file in the following directory: "/etc/network/". You can do so with any editor you choose. The command I used was:
sudo vim /etc/network/interfaces
Right now, the file should only have a few lines in it. Details about configuring this file are important, so you must know where things are plugged in. In eth0, I had my Ethernet going to the switch, and eth1 had the Ethernet going to XPS. As such, here are the contents of my file after altering it:
#Loopback network interface
auto lo
iface lo inet loopback #Primary Interface - Goes to Switch
auto eth0
iface eth0 inet static
address 192.168.2.2
network 192.168.2.0
netmask 255.255.0.0
gateway 192.168.2.1
#Secondary Interface - Goes to XPS
auto eth1
iface eth1 inet static
address 192.168.1.1
network 192.168.1.0
netmask 255.255.0.0
Now, save the file. I used ":wq" (without quotes) to save and quit in vim.
Next, forwarding must be enabled. In order to do so, use the following command:
sudo sysctl -w netipv4.ipforward=1
Then, you need to restart your networking services. This varies with different distributions and versions, but rebooting the entire system should work for all of them.
After the machine has booted back up, it is time to do some routing. First, assign this machine as the gateway for the XPS on eth1*:
sudo route add 192.168.1.0 eth1
Then create another route so the packets get sent to the default gateway*.
sudo route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.0 eth1
After adding in these commands, if you do a route -n, you should get a screen with routes either identical or fairly close depending on your settings:
*Note: These settings are not permanent and will release after a reboot.
Finally, it is necessary to append a rule to the POSTROUTING chain in the NAT table. This rule will route the traffic going to 192.168.1.0 out the interface eth0 and to the gateway 192.168.2.2. To do so, try this command*:
sudo iptables -t nat -A POSTROUTING ! -d 192.168.1.0 -o eth0 -j SNAT --to-source 192.168.2.2
*Note: This setup is without any filtering at all, which is not a recommended practice. You can filter your packets further with iptables.
Now, it should be possible to ping from the Dell XPS all the way to the MacBook, without any packet loss.
Subscribe to:
Posts (Atom)